From: Bruno Haible Date: Tue, 16 Sep 2025 20:04:46 +0000 (+0200) Subject: strerror_r-posix: Fix truncation code (regression today). X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c172e838f939f7c97daed1a80a7ec3479b4c43c6;p=thirdparty%2Fgnulib.git strerror_r-posix: Fix truncation code (regression today). * lib/strerror_r.c (strerror_r): Fix use of snprintf again. --- diff --git a/ChangeLog b/ChangeLog index 54db84a8cb..ef87fda436 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2025-09-16 Bruno Haible + + strerror_r-posix: Fix truncation code (regression today). + * lib/strerror_r.c (strerror_r): Fix use of snprintf again. + 2025-09-16 Bruno Haible inttypes-h tests: Avoid compilation error on mingw. @@ -24,7 +29,7 @@ 2025-09-16 Bruno Haible - 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 diff --git a/lib/strerror_r.c b/lib/strerror_r.c index b67684ebe6..1e6974e327 100644 --- a/lib/strerror_r.c +++ b/lib/strerror_r.c @@ -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'; }