2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-14 23:31:39 +00:00

Do not go past the end of the argv[] array.

This bug found by setting read and write watchpoints at NULL in bochs.
This commit is contained in:
Michael Brown 2007-01-14 02:01:26 +00:00
parent 55e6d7b70c
commit 98240d99f0

View File

@ -227,6 +227,10 @@ int getopt_long ( int argc, char * const argv[], const char *optstring,
enum getopt_argument_requirement has_arg;
int option;
/* Check for end of argv array */
if ( optind >= argc )
return -1;
/* Check for end of options */
if ( *(opttext++) != '-' )
return -1;