From 5b190e1bb6de059c031907499b85b8b21409ab7b Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Wed, 12 Aug 2020 15:02:39 -0400 Subject: send endptr properly if we reach the NUL terminator --- src/stdlib/_strtoi.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/stdlib') 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 { -- cgit v1.2.1