]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
strerror_r-posix: Fix truncation code (regression today).
authorBruno Haible <bruno@clisp.org>
Tue, 16 Sep 2025 20:04:46 +0000 (22:04 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 16 Sep 2025 20:04:46 +0000 (22:04 +0200)
* lib/strerror_r.c (strerror_r): Fix use of snprintf again.

ChangeLog
lib/strerror_r.c

index 54db84a8cb82f67718f309def4132b33b8a2ff5a..ef87fda436a3191803e21a46bf45548c51ff44f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-09-16  Bruno Haible  <bruno@clisp.org>
+
+       strerror_r-posix: Fix truncation code (regression today).
+       * lib/strerror_r.c (strerror_r): Fix use of snprintf again.
+
 2025-09-16  Bruno Haible  <bruno@clisp.org>
 
        inttypes-h tests: Avoid compilation error on mingw.
@@ -24,7 +29,7 @@
 
 2025-09-16  Bruno Haible  <bruno@clisp.org>
 
-       strerror_r: Ensure a trailing NUL when truncating.
+       strerror_r-posix: Ensure a trailing NUL when truncating.
        * lib/strerror_r.c (strerror_r): Fix use of snprintf.
 
 2025-09-16  Bruno Haible  <bruno@clisp.org>
index b67684ebe648320646b02c220cd52def432263b6..1e6974e3278f057ceeb649e617caa64659e83965 100644 (file)
@@ -450,9 +450,9 @@ strerror_r (int errnum, char *buf, size_t buflen)
 #endif
 #if defined __HAIKU__
         /* For consistency with perror().  */
-        snprintf (buf, buflen - 1, "Unknown Application Error (%d)", errnum);
+        snprintf (buf, buflen, "Unknown Application Error (%d)", errnum);
 #else
-        snprintf (buf, buflen - 1, "Unknown error %d", errnum);
+        snprintf (buf, buflen, "Unknown error %d", errnum);
 #endif
         buf[buflen - 1] = '\0';
       }