[parseopt] Treat empty integer strings in user input as invalid

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/111/merge
Michael Brown 2020-06-19 17:29:46 +01:00
parent 2000297011
commit 8830f2f351
1 changed files with 1 additions and 1 deletions

View File

@ -93,7 +93,7 @@ int parse_integer ( char *text, unsigned int *value ) {
/* Parse integer */
*value = strtoul ( text, &endp, 0 );
if ( *endp ) {
if ( *endp || ( ! *text ) ) {
printf ( "\"%s\": invalid integer value\n", text );
return -EINVAL_INTEGER;
}