]> Savannah Git Hosting - gnulib.git/commitdiff
setlocale: Fix a buffer overflow check (mistake in yesterday's commit).
authorBruno Haible <bruno@clisp.org>
Tue, 24 Dec 2024 17:35:01 +0000 (18:35 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 24 Dec 2024 17:35:01 +0000 (18:35 +0100)
* lib/setlocale.c (setlocale_unixlike): Update buffer overflow check.

ChangeLog
lib/setlocale.c

index 91e8c5ef98437b2d1daa171916093025756913f1..38b95c2479e877e67526cb0ad6c35dff28c398db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-12-24  Bruno Haible  <bruno@clisp.org>
+
+       setlocale: Fix a buffer overflow check (mistake in yesterday's commit).
+       * lib/setlocale.c (setlocale_unixlike): Update buffer overflow check.
+
 2024-12-24  Bruno Haible  <bruno@clisp.org>
 
        doc: Document mingw with MSVCRT vs. mingw with UCRT.
index 3cb711d8e1ebe74cf68114be431615214cb7f538..c239bd1e2cb4fa8c29821833584b8665a4846e3e 100644 (file)
@@ -818,7 +818,7 @@ setlocale_unixlike (int category, const char *locale)
                             size_t part2_len = strlen (part2) + 1;
                             char buf[64+64+6];
 
-                            if (!(part1_len + 1 + part2_len <= sizeof (buf)))
+                            if (!(part1_len + 1 + part2_len + 6 <= sizeof (buf)))
                               abort ();
                             memcpy (buf, part1, part1_len);
                             buf[part1_len] = '_';