david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

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
1 changed files with 4 additions and 0 deletions

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;