[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bin/133473: [patch] pkg_info throws segmentation fault if given non-existent long option
- To: freebsd-gnats-submit_(_at_)_FreeBSD_(_dot_)_org
- Subject: bin/133473: [patch] pkg_info throws segmentation fault if given non-existent long option
- From: Rafal Grodzinski <grodzix_(_at_)_gmail_(_dot_)_com>
- Date: Tue, 7 Apr 2009 20:45:22 GMT
- Cc:
- Resent-date: Tue, 7 Apr 2009 20:50:05 GMT
- Resent-from: FreeBSD-gnats-submit_(_at_)_FreeBSD_(_dot_)_org (GNATS Filer)
- Resent-message-id: <200904072050_(_dot_)_n37Ko5h4041651_(_at_)_freefall_(_dot_)_freebsd_(_dot_)_org>
- Resent-reply-to: FreeBSD-gnats-submit_(_at_)_FreeBSD_(_dot_)_org, Rafal Grodzinski <grodzix_(_at_)_gmail_(_dot_)_com>
- Resent-to: freebsd-bugs_(_at_)_FreeBSD_(_dot_)_org
>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_(_at_)_logan_(_dot_)_cse_(_dot_)_buffalo_(_dot_)_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_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe_(_at_)_freebsd_(_dot_)_org"
Visit your host, monkey.org