summaryrefslogtreecommitdiff
path: root/userland/libc/stdlib/strtoll.c
diff options
context:
space:
mode:
Diffstat (limited to 'userland/libc/stdlib/strtoll.c')
-rw-r--r--userland/libc/stdlib/strtoll.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/userland/libc/stdlib/strtoll.c b/userland/libc/stdlib/strtoll.c
index d1eacde..0e397ff 100644
--- a/userland/libc/stdlib/strtoll.c
+++ b/userland/libc/stdlib/strtoll.c
@@ -44,12 +44,15 @@ long long strtoll(const char *str, char **restrict endptr, int base) {
if (2 <= base && 36 >= base) {
for (; *str; str++) {
+ int val = get_value(*str, base);
+ if(-1 == val) {
+ break;
+ }
if (ret_value > LLONG_MAX / base) {
errno = ERANGE;
return LLONG_MAX;
}
ret_value *= base;
- int val = get_value(*str, base);
if (ret_value > LLONG_MAX - val) {
errno = ERANGE;
return LLONG_MAX;