mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 05:21:49 +03: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:
@@ -227,6 +227,10 @@ int getopt_long ( int argc, char * const argv[], const char *optstring,
|
|||||||
enum getopt_argument_requirement has_arg;
|
enum getopt_argument_requirement has_arg;
|
||||||
int option;
|
int option;
|
||||||
|
|
||||||
|
/* Check for end of argv array */
|
||||||
|
if ( optind >= argc )
|
||||||
|
return -1;
|
||||||
|
|
||||||
/* Check for end of options */
|
/* Check for end of options */
|
||||||
if ( *(opttext++) != '-' )
|
if ( *(opttext++) != '-' )
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user