mirror of
https://github.com/ipxe/ipxe
synced 2025-12-18 18:40:24 +03:00
[util] Treat empty integer strings as invalid
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -207,14 +207,14 @@ static int parse_options ( const int argc, char **argv,
|
||||
switch ( c ) {
|
||||
case 'v':
|
||||
opts->vendor = strtoul ( optarg, &end, 16 );
|
||||
if ( *end ) {
|
||||
if ( *end || ( ! *optarg ) ) {
|
||||
eprintf ( "Invalid vendor \"%s\"\n", optarg );
|
||||
exit ( 2 );
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
opts->device = strtoul ( optarg, &end, 16 );
|
||||
if ( *end ) {
|
||||
if ( *end || ( ! *optarg ) ) {
|
||||
eprintf ( "Invalid device \"%s\"\n", optarg );
|
||||
exit ( 2 );
|
||||
}
|
||||
|
||||
@@ -996,7 +996,7 @@ static int parse_options ( const int argc, char **argv,
|
||||
switch ( c ) {
|
||||
case 's':
|
||||
opts->subsystem = strtoul ( optarg, &end, 0 );
|
||||
if ( *end ) {
|
||||
if ( *end || ( ! *optarg ) ) {
|
||||
eprintf ( "Invalid subsytem \"%s\"\n",
|
||||
optarg );
|
||||
exit ( 2 );
|
||||
|
||||
Reference in New Issue
Block a user