]> Savannah Git Hosting - gnulib.git/commitdiff
mbsnlen: Fix bug (regression 2023-09-26).
authorBruno Haible <bruno@clisp.org>
Wed, 19 Jun 2024 00:31:30 +0000 (02:31 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 30 Jun 2024 22:13:52 +0000 (00:13 +0200)
* lib/mbsnlen.c (mbsnlen): Fix bug in GNULIB_MCEL_PREFER implementation.

ChangeLog
lib/mbsnlen.c

index 1dc942337b542286cbab8874b275a41f262898c7..727f8585b87b721034b8d1bb98466c60b24339ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-06-18  Bruno Haible  <bruno@clisp.org>
+
+       mbsnlen: Fix bug (regression 2023-09-26).
+       * lib/mbsnlen.c (mbsnlen): Fix bug in GNULIB_MCEL_PREFER implementation.
+
 2024-06-11  Bruno Haible  <bruno@clisp.org>
 
        test-framework-sh: Fix 'returns_' to not turn off tracing permanently.
index baadf163cae1bc0a6ee8cb9a829c4eda4d93bc77..1ce79bfb4b8e5b680ea86430ace30e31a355a103 100644 (file)
@@ -40,7 +40,7 @@ mbsnlen (const char *string, size_t len)
       const char *string_end = string + len;
 
 #if GNULIB_MCEL_PREFER
-      for (; *string; string += mcel_scan (string, string_end).len)
+      for (; string < string_end; string += mcel_scan (string, string_end).len)
         count++;
 #else
       mbif_state_t state;