mirror of https://github.com/ipxe/ipxe.git
[parseopt] Treat empty integer strings in user input as invalid
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/111/merge
parent
2000297011
commit
8830f2f351
|
@ -93,7 +93,7 @@ int parse_integer ( char *text, unsigned int *value ) {
|
||||||
|
|
||||||
/* Parse integer */
|
/* Parse integer */
|
||||||
*value = strtoul ( text, &endp, 0 );
|
*value = strtoul ( text, &endp, 0 );
|
||||||
if ( *endp ) {
|
if ( *endp || ( ! *text ) ) {
|
||||||
printf ( "\"%s\": invalid integer value\n", text );
|
printf ( "\"%s\": invalid integer value\n", text );
|
||||||
return -EINVAL_INTEGER;
|
return -EINVAL_INTEGER;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue