Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

veriexecctl(8) segfaults when no argument is given

Hi people.
veriexecctl(8) segfaults under -current. Here is the backtrace:

[stathis@netbsd /usr/src/sbin/veriexecctl] sudo gdb ./veriexecctl
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386--netbsdelf"...
(gdb) r
Starting program: /usr/src/sbin/veriexecctl/veriexecctl

Program received signal SIGSEGV, Segmentation fault.
0xbbb9959a in strcasecmp () from /lib/
(gdb) bt
#0  0xbbb9959a in strcasecmp () from /lib/
#1  0x0804acb9 in main (argc=0, argv=Cannot access memory at address 0x4
) at veriexecctl.c:236

It segfaults when no argument is given, thus getopt() returns -1, the
`default' label isn't executed, usage() isn't executed either, and
later on it tries to access argv[0] which corresponds to argv[1] since
it was augmented by 1 in line 228: argv += optind; (optind is
initialized to 1)

I attach a patch that fixes it. It also contains a couple of
whitespace removals "since we are here".

Best regards,
Stathis Kamperis

Home | Main Index | Thread Index | Old Index