From 8830f2f3514751e702199600fa6d0c42522a709a Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 19 Jun 2020 17:29:46 +0100 Subject: [parseopt] Treat empty integer strings in user input as invalid Signed-off-by: Michael Brown --- src/core/parseopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/parseopt.c b/src/core/parseopt.c index 3ddf94f..0070800 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; } -- cgit v1.1