Skip leading space (ala strtol) so that we can pick up the sign
even if it is not the first character of the string.
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
#else
|
#else
|
||||||
# include "compat/stdbool.h"
|
# include "compat/stdbool.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
@@ -62,6 +63,9 @@ sudo_strtoid(const char *p, const char *sep, char **endp, const char **errstr)
|
|||||||
bool valid = false;
|
bool valid = false;
|
||||||
debug_decl(sudo_strtoid, SUDO_DEBUG_UTIL)
|
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)
|
if (sep == NULL)
|
||||||
sep = "";
|
sep = "";
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
Reference in New Issue
Block a user