]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[parseopt] Treat empty integer strings in user input as invalid
authorMichael Brown <mcb30@ipxe.org>
Fri, 19 Jun 2020 16:29:46 +0000 (17:29 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 19 Jun 2020 16:33:27 +0000 (17:33 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/parseopt.c

index 3ddf94f3d3dbb55cf248c4d467fcde51594d7e83..0070800886f1cfc4ebfe37156b068cc419f6055d 100644 (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;
        }