From: Michael Brown Date: Fri, 19 Jun 2020 16:29:46 +0000 (+0100) Subject: [parseopt] Treat empty integer strings in user input as invalid X-Git-Tag: secboot-ioactive-20200603~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8830f2f3514751e702199600fa6d0c42522a709a;p=thirdparty%2Fipxe.git [parseopt] Treat empty integer strings in user input as invalid Signed-off-by: Michael Brown --- diff --git a/src/core/parseopt.c b/src/core/parseopt.c index 3ddf94f3d..007080088 100644 --- a/src/core/parseopt.c +++ b/src/core/parseopt.c @@ -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; }