diff --git a/libs/libc/stdlib/lib_strtoul.c b/libs/libc/stdlib/lib_strtoul.c index 92f6bcc08c7..3f4959aab79 100644 --- a/libs/libc/stdlib/lib_strtoul.c +++ b/libs/libc/stdlib/lib_strtoul.c @@ -103,6 +103,11 @@ unsigned long strtoul(FAR const char *nptr, FAR char **endptr, int base) nptr++; } + while (lib_isbasedigit(*nptr, base, &value)) + { + nptr++; + } + if (sign == '-') { accum = (~accum) + 1; diff --git a/libs/libc/stdlib/lib_strtoull.c b/libs/libc/stdlib/lib_strtoull.c index 156e557d762..b3b68045163 100644 --- a/libs/libc/stdlib/lib_strtoull.c +++ b/libs/libc/stdlib/lib_strtoull.c @@ -107,6 +107,11 @@ unsigned long long strtoull(FAR const char *nptr, nptr++; } + while (lib_isbasedigit(*nptr, base, &value)) + { + nptr++; + } + if (sign == '-') { accum = (~accum) + 1;