aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-06-19 17:29:46 +0100
committerMichael Brown <mcb30@ipxe.org>2020-06-19 17:33:27 +0100
commit8830f2f3514751e702199600fa6d0c42522a709a (patch)
tree9f7e182a487bdf7e299172cb2e7d0d9c4fe44ab3 /src/core
parent2000297011172a9f04be41aca76411bde2c54a76 (diff)
downloadipxe-8830f2f3514751e702199600fa6d0c42522a709a.zip
ipxe-8830f2f3514751e702199600fa6d0c42522a709a.tar.gz
ipxe-8830f2f3514751e702199600fa6d0c42522a709a.tar.bz2
[parseopt] Treat empty integer strings in user input as invalid
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/parseopt.c2
1 files changed, 1 insertions, 1 deletions
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;
}