>Number: 133473
>Category: bin
>Synopsis: [patch] pkg_info throws segmentation fault if given non-existent long option
>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: Tue Apr 07 20:50:05 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Rafal Grodzinski
>Release: 7.1-Release
>Organization:
>Environment:
FreeBSD grodzix 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 14:37:25 UTC 2009 root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
pkg_info (usr.sbin/pkg_install/info) throws segmentation fault if non existent long option is provided.
Array struct option longopts[] in main.c isn't ended with {NULL, 0, NULL, 0} so getopt_long doesn't know where to stop and tries to read past the last element of the array.
>How-To-Repeat:
pkg_info --y
pkg_info --ble
>Fix:
Add {NULL, 0, NULL, 0} at the end of struct option longopts[] array in main.c
Patch attached with submission follows:
--- /usr/src/usr.sbin/pkg_install/info/main.c 2008-11-25 02:59:29.000000000 +0000
+++ main.c 2009-04-07 20:01:57.000000000 +0000
@@ -58,6 +58,7 @@
{ "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'P' },
{ "which", required_argument, NULL, 'W' },
+ { NULL, 0, NULL, 0 },
};
int
>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"