summaryrefslogtreecommitdiff
path: root/src/stdlib
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-12 15:02:39 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-12 15:02:39 -0400
commit5b190e1bb6de059c031907499b85b8b21409ab7b (patch)
tree0ad7373d1815afe7aa17a0cdcd9198c747b3bc45 /src/stdlib
parent9046b2494ce369d64e389d540446a8415c165ee2 (diff)
send endptr properly if we reach the NUL terminator
Diffstat (limited to 'src/stdlib')
-rw-r--r--src/stdlib/_strtoi.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stdlib/_strtoi.h b/src/stdlib/_strtoi.h
index a46d6c0c..21b22ee9 100644
--- a/src/stdlib/_strtoi.h
+++ b/src/stdlib/_strtoi.h
@@ -112,6 +112,10 @@
nptr++;
}
+ if (endptr && (*endptr == NULL)) {
+ *endptr = (void*)nptr;
+ }
+
if (overflow) {
ret = (sign == 1) ? max : min;
} else {