]> Savannah Git Hosting - gnulib.git/commitdiff
Avoid -Wformat=security failures with --disable-nls
authorPádraig Brady <P@draigBrady.com>
Fri, 17 Jan 2025 13:01:40 +0000 (13:01 +0000)
committerPádraig Brady <P@draigBrady.com>
Fri, 17 Jan 2025 13:04:55 +0000 (13:04 +0000)
This was noticed with GCC 14.

* lib/xmemcoll.c: Always use format arguments.
* lib/xprintf.c: Likewise.

ChangeLog
lib/xmemcoll.c
lib/xprintf.c

index 8a77ff50a8626651861fee4cff60aa8f2108acad..f80d7579c088a8742510c9d4461b076d91e30cf1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-01-17  Pádraig Brady  <P@draigBrady.com>
+
+       Avoid -Wformat=security failures with --disable-nls
+       This was noticed with GCC 14.
+       * lib/xmemcoll.c: Always use format arguments.
+       * lib/xprintf.c: Likewise.
+
 2025-01-16  Paul Eggert  <eggert@cs.ucla.edu>
 
        crc-x86_64: fix unaligned access
index d1b141c9e057d5b2371d05804ebe2f61465d1a41..c0ac7c486366f509c1918a34fe3c4b8db2497f30 100644 (file)
@@ -36,8 +36,8 @@ collate_error (int collation_errno,
                char const *s1, size_t s1len,
                char const *s2, size_t s2len)
 {
-  error (0, collation_errno, _("string comparison failed"));
-  error (0, 0, _("Set LC_ALL='C' to work around the problem."));
+  error (0, collation_errno, "%s", _("string comparison failed"));
+  error (0, 0, "%s", _("Set LC_ALL='C' to work around the problem."));
   error (exit_failure, 0,
          _("The strings compared were %s and %s."),
          quotearg_n_style_mem (0, locale_quoting_style, s1, s1len),
index 790af5320b9b856ffa31b0e58c7af0e2eae7b26d..4d9a3e5e4def54b32c07ba542df5d9e4340e3253 100644 (file)
@@ -45,7 +45,7 @@ xvprintf (char const *restrict format, va_list args)
 {
   off64_t retval = vzprintf (format, args);
   if (retval < 0 && ! ferror (stdout))
-    error (exit_failure, errno, _("cannot perform formatted output"));
+    error (exit_failure, errno, "%s", _("cannot perform formatted output"));
 
   return retval;
 }
@@ -67,7 +67,7 @@ xvfprintf (FILE *restrict stream, char const *restrict format, va_list args)
 {
   off64_t retval = vfzprintf (stream, format, args);
   if (retval < 0 && ! ferror (stream))
-    error (exit_failure, errno, _("cannot perform formatted output"));
+    error (exit_failure, errno, "%s", _("cannot perform formatted output"));
 
   return retval;
 }