Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Mar 2011 14:32:41 GMT
From:      Urankar Mikael <mikael.urankar@ujf-grenoble.fr>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/155349: [patch] kbdmap segfault when rc.conf is non existent
Message-ID:  <201103071432.p27EWfvp081753@red.freebsd.org>
Resent-Message-ID: <201103071440.p27Ee7J8002083@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         155349
>Category:       bin
>Synopsis:       [patch] kbdmap segfault when rc.conf is non existent
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 07 14:40:07 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Urankar Mikael
>Release:        
>Organization:
>Environment:
FreeBSD iut-mir-o.ujf-grenoble.fr 9.0-CURRENT FreeBSD 9.0-CURRENT #39 r219368M: Mon Mar  7 12:15:50 CET 2011     murankar@iut-mir-o.ujf-grenoble.fr:/usr/obj/usr/src/sys/LETHE  amd64
>Description:
kbdmap segfault when rc.conf is non existent

Here is the backtrace :

Starting program: /usr/obj/usr/src/usr.sbin/kbdmap/kbdmap
kbdcontrol: getting keymap: Inappropriate ioctl for device
You are not on a virtual console - expect certain strange side-effects
Could not open /etc/rc.conf for reading

Program received signal SIGSEGV, Segmentation fault.
0x00000008009214e7 in fclose () from /lib/libc.so.7
(gdb) bt full
#0  0x00000008009214e7 in fclose () from /lib/libc.so.7
No symbol table info available.
#1  0x000000000040249c in main (argc=1, argv=0x7fffffffd9a8) at /usr/src/usr.sbin/kbdmap/kbdmap.c:232
No locals.

>How-To-Repeat:
Delete /etc/rc.conf and run kbdmap
>Fix:
Close the file stream only if it was successfully opened.

Patch attached with submission follows:

Index: kbdmap.c
===================================================================
--- kbdmap.c	(révision 219368)
+++ kbdmap.c	(copie de travail)
@@ -226,10 +226,10 @@
 				}
 			}
 		}
+		fclose(fp);
 	} else
 		fprintf(stderr, "Could not open %s for reading\n", sysconfig);
 
-	fclose(fp);
 	return fnt;
 }
 


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103071432.p27EWfvp081753>