diff --git a/lib/util/strtoid.c b/lib/util/strtoid.c index 9d1c9fbc8..623ea685a 100644 --- a/lib/util/strtoid.c +++ b/lib/util/strtoid.c @@ -37,6 +37,7 @@ #else # include "compat/stdbool.h" #endif +#include #include #include @@ -62,6 +63,9 @@ sudo_strtoid(const char *p, const char *sep, char **endp, const char **errstr) bool valid = false; debug_decl(sudo_strtoid, SUDO_DEBUG_UTIL) + /* skip leading space so we can pick up the sign, if any */ + while (isspace((unsigned char)*p)) + p++; if (sep == NULL) sep = ""; errno = 0;