mirror of https://github.com/ipxe/ipxe.git
[util] Treat empty integer strings as invalid
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/111/merge
parent
770a7bd43a
commit
2000297011
|
@ -207,14 +207,14 @@ static int parse_options ( const int argc, char **argv,
|
||||||
switch ( c ) {
|
switch ( c ) {
|
||||||
case 'v':
|
case 'v':
|
||||||
opts->vendor = strtoul ( optarg, &end, 16 );
|
opts->vendor = strtoul ( optarg, &end, 16 );
|
||||||
if ( *end ) {
|
if ( *end || ( ! *optarg ) ) {
|
||||||
eprintf ( "Invalid vendor \"%s\"\n", optarg );
|
eprintf ( "Invalid vendor \"%s\"\n", optarg );
|
||||||
exit ( 2 );
|
exit ( 2 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
opts->device = strtoul ( optarg, &end, 16 );
|
opts->device = strtoul ( optarg, &end, 16 );
|
||||||
if ( *end ) {
|
if ( *end || ( ! *optarg ) ) {
|
||||||
eprintf ( "Invalid device \"%s\"\n", optarg );
|
eprintf ( "Invalid device \"%s\"\n", optarg );
|
||||||
exit ( 2 );
|
exit ( 2 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -996,7 +996,7 @@ static int parse_options ( const int argc, char **argv,
|
||||||
switch ( c ) {
|
switch ( c ) {
|
||||||
case 's':
|
case 's':
|
||||||
opts->subsystem = strtoul ( optarg, &end, 0 );
|
opts->subsystem = strtoul ( optarg, &end, 0 );
|
||||||
if ( *end ) {
|
if ( *end || ( ! *optarg ) ) {
|
||||||
eprintf ( "Invalid subsytem \"%s\"\n",
|
eprintf ( "Invalid subsytem \"%s\"\n",
|
||||||
optarg );
|
optarg );
|
||||||
exit ( 2 );
|
exit ( 2 );
|
||||||
|
|
Loading…
Reference in New Issue