diff options
author | Michael Brown <mcb30@ipxe.org> | 2020-06-19 16:56:02 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2020-06-19 16:56:02 +0100 |
commit | 2000297011172a9f04be41aca76411bde2c54a76 (patch) | |
tree | a142c1e3084861f3785555037fc56488a53cc8b7 /src/util | |
parent | 770a7bd43aa236fe415e0643e2f452e1ad191596 (diff) | |
download | ipxe-2000297011172a9f04be41aca76411bde2c54a76.zip ipxe-2000297011172a9f04be41aca76411bde2c54a76.tar.gz ipxe-2000297011172a9f04be41aca76411bde2c54a76.tar.bz2 |
[util] Treat empty integer strings as invalid
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/efirom.c | 4 | ||||
-rw-r--r-- | src/util/elf2efi.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/util/efirom.c b/src/util/efirom.c index 93cd79f..8fa15ca 100644 --- a/src/util/efirom.c +++ b/src/util/efirom.c @@ -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 ); } diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c index bcd53c9..4f517d7 100644 --- a/src/util/elf2efi.c +++ b/src/util/elf2efi.c @@ -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 ); |