bin/155349: [patch] kbdmap segfault when rc.conf is non existent

Urankar Mikael mikael.urankar at ujf-grenoble.fr
Mon Mar 7 14:40:07 UTC 2011


>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 at 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:


More information about the freebsd-bugs mailing list