From 386e4642dcc55dc2ea3f933e29a6adc05540216e Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 21 Nov 2025 09:49:44 +0800 Subject: [PATCH] * lib/strnlen.c (strnlen): Fix syntax error in Gnulib module. --- lib/strnlen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/strnlen.c b/lib/strnlen.c index 5a03d7ec942..155a594fccd 100644 --- a/lib/strnlen.c +++ b/lib/strnlen.c @@ -25,9 +25,10 @@ size_t strnlen (const char *s, size_t maxlen) { + size_t i = 0; /* Do not use memchr, because on some platforms memchr has undefined behavior if MAXLEN exceeds the number of bytes in S. */ - for (size_t i = 0; i < maxlen && s[i]; i++) + for (; i < maxlen && s[i]; i++) continue; return i; }