From: Ondrej Zajicek Date: Fri, 31 Jul 2026 12:15:10 +0000 (+0200) Subject: Lib: Fix endptr in bstrtoul16() X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;p=thirdparty%2Fbird.git Lib: Fix endptr in bstrtoul16() The endptr in bstrtoul16() should be always defined on return to avoid bad usage by callers. Otherwise, dereferencing undefined ptr may lead to crash on parsing long numbers. Reported-By: Benedikt Neuffer --- diff --git a/lib/strtoul.c b/lib/strtoul.c index 420931a40..15d2c78bc 100644 --- a/lib/strtoul.c +++ b/lib/strtoul.c @@ -56,6 +56,7 @@ bstrtoul16(const char *str, char **end) } } + *end = (char *) &(str[16]); /* Overflow position */ errno = ERANGE; return UINT64_MAX; }