changeset: 7073:4e29b337e967
user:      TAKAHASHI Tamotsu <tta...@lapis.plala.or.jp>
date:      Thu Jun 01 13:33:21 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/4e29b337e967

Fix "format string is not a string literal" warnings. (closes #3949)

Mutt calls msgfmt with '-c' to verify that translation format strings
match, but it is still safer to indirect strings with no formatting
through %s.

diffs (202 lines):

diff -r 093b0c6c6d86 -r 4e29b337e967 crypt-gpgme.c
--- a/crypt-gpgme.c     Wed May 31 16:19:22 2017 -0700
+++ b/crypt-gpgme.c     Thu Jun 01 13:33:21 2017 -0700
@@ -3447,7 +3447,7 @@
   fprintf (fp, _("Key Type ..: %s, %lu bit %s\n"), s2, aval, s);
 
   /* L10N: DOTFILL */
-  fprintf (fp, _("Key Usage .: "));
+  fprintf (fp, "%s", _("Key Usage .: "));
   delim = "";
 
   if (key_check_cap (key, KEY_CAP_CAN_ENCRYPT))
@@ -3513,7 +3513,7 @@
       if (s)
        {
           /* L10N: DOTFILL */
-         fprintf (fp, _("Issued By .: "));
+         fprintf (fp, "%s", _("Issued By .: "));
          parse_and_print_user_id (fp, s);
          putc ('\n', fp);
        }
@@ -3598,7 +3598,7 @@
           fprintf (fp, _("Key Type ..: %s, %lu bit %s\n"), "PGP", aval, s);
 
           /* L10N: DOTFILL */
-          fprintf (fp, _("Key Usage .: "));
+          fprintf (fp, "%s", _("Key Usage .: "));
           delim = "";
 
          if (subkey->can_encrypt)
diff -r 093b0c6c6d86 -r 4e29b337e967 hook.c
--- a/hook.c    Wed May 31 16:19:22 2017 -0700
+++ b/hook.c    Thu Jun 01 13:33:21 2017 -0700
@@ -275,7 +275,7 @@
     {
       if (current_hook_type)
       {
-       snprintf (err->data, err->dsize,
+       snprintf (err->data, err->dsize, "%s",
                  _("unhook: Can't do unhook * from within a hook."));
        return -1;
       }
diff -r 093b0c6c6d86 -r 4e29b337e967 init.c
--- a/init.c    Wed May 31 16:19:22 2017 -0700
+++ b/init.c    Thu Jun 01 13:33:21 2017 -0700
@@ -56,7 +56,7 @@
   if ((CurrentMenu == MENU_PAGER) && (idx >= 0) &&     \
            (MuttVars[idx].flags & R_RESORT)) \
        { \
-         snprintf (err->data, err->dsize, \
+         snprintf (err->data, err->dsize, "%s", \
            _("Not available in this menu.")); \
          return (-1); \
        }
@@ -524,7 +524,7 @@
 
   if (t->nmatch > t->rx->rx->re_nsub)
   {
-    snprintf (err->data, err->dsize, _("Not enough subexpressions for "
+    snprintf (err->data, err->dsize, "%s", _("Not enough subexpressions for "
                                        "template"));
     remove_from_replace_list(list, pat);
     return -1;
@@ -2097,13 +2097,13 @@
     {
       if (query || unset || inv)
       {
-       snprintf (err->data, err->dsize, _("prefix is illegal with reset"));
+       snprintf (err->data, err->dsize, "%s", _("prefix is illegal with 
reset"));
        return (-1);
       }
 
       if (s && *s->dptr == '=')
       {
-       snprintf (err->data, err->dsize, _("value is illegal with reset"));
+       snprintf (err->data, err->dsize, "%s", _("value is illegal with 
reset"));
        return (-1);
       }
      
@@ -2111,7 +2111,7 @@
       {
        if (CurrentMenu == MENU_PAGER)
        {
-         snprintf (err->data, err->dsize, _("Not available in this menu."));
+         snprintf (err->data, err->dsize, "%s", _("Not available in this 
menu."));
          return (-1);
        }
        for (idx = 0; MuttVars[idx].option; idx++)
@@ -2138,7 +2138,7 @@
       {
        if (unset || inv || query)
        {
-         snprintf (err->data, err->dsize, _("Usage: set variable=yes|no"));
+         snprintf (err->data, err->dsize, "%s", _("Usage: set 
variable=yes|no"));
          return (-1);
        }
 
@@ -2150,7 +2150,7 @@
          unset = 1;
        else
        {
-         snprintf (err->data, err->dsize, _("Usage: set variable=yes|no"));
+         snprintf (err->data, err->dsize, "%s", _("Usage: set 
variable=yes|no"));
          return (-1);
        }
       }
diff -r 093b0c6c6d86 -r 4e29b337e967 main.c
--- a/main.c    Wed May 31 16:19:22 2017 -0700
+++ b/main.c    Thu Jun 01 13:33:21 2017 -0700
@@ -699,7 +699,7 @@
        }
        printf (_("Debugging at level %d.\n"), debuglevel);
 #else
-       printf _("DEBUG was not defined during compilation.  Ignored.\n");
+       printf ("%s", _("DEBUG was not defined during compilation.  
Ignored.\n"));
 #endif
        break;
 
diff -r 093b0c6c6d86 -r 4e29b337e967 mutt_ssl.c
--- a/mutt_ssl.c        Wed May 31 16:19:22 2017 -0700
+++ b/mutt_ssl.c        Thu Jun 01 13:33:21 2017 -0700
@@ -727,7 +727,7 @@
 
   if (!X509_digest (cert, hashfunc(), md, &n))
   {
-    snprintf (s, l, _("[unable to calculate]"));
+    snprintf (s, l, "%s", _("[unable to calculate]"));
   }
   else
   {
@@ -1194,7 +1194,7 @@
               x509_get_part (x509_issuer, part[u]));
 
   row++;
-  snprintf (menu->dialog[row++], SHORT_STRING, _("This certificate is valid"));
+  snprintf (menu->dialog[row++], SHORT_STRING, "%s", _("This certificate is 
valid"));
   snprintf (menu->dialog[row++], SHORT_STRING, _("   from %s"),
       asn1time_to_string (X509_get_notBefore (cert)));
   snprintf (menu->dialog[row++], SHORT_STRING, _("     to %s"),
diff -r 093b0c6c6d86 -r 4e29b337e967 pattern.c
--- a/pattern.c Wed May 31 16:19:22 2017 -0700
+++ b/pattern.c Thu Jun 01 13:33:21 2017 -0700
@@ -268,7 +268,7 @@
   }
   if (!*buf.data)
   {
-    snprintf (err->data, err->dsize, _("Empty expression"));
+    snprintf (err->data, err->dsize, "%s", _("Empty expression"));
     return (-1);
   }
 
@@ -588,7 +588,7 @@
   }
   if (!*buffer.data)
   {
-    snprintf (err->data, err->dsize, _("Empty expression"));
+    snprintf (err->data, err->dsize, "%s", _("Empty expression"));
     return (-1);
   }
 
@@ -931,7 +931,7 @@
        {
          if (!*ps.dptr)
          {
-           snprintf (err->data, err->dsize, _("missing parameter"));
+           snprintf (err->data, err->dsize, "%s", _("missing parameter"));
            mutt_pattern_free (&curlist);
            return NULL;
          }
diff -r 093b0c6c6d86 -r 4e29b337e967 pop.c
--- a/pop.c     Wed May 31 16:19:22 2017 -0700
+++ b/pop.c     Thu Jun 01 13:33:21 2017 -0700
@@ -98,7 +98,7 @@
        pop_data->cmd_top = 0;
 
        dprint (1, (debugfile, "pop_read_header: unset TOP capability\n"));
-       snprintf (pop_data->err_msg, sizeof (pop_data->err_msg),
+       snprintf (pop_data->err_msg, sizeof (pop_data->err_msg), "%s",
                _("Command TOP is not supported by server."));
       }
     }
@@ -272,7 +272,7 @@
       pop_data->cmd_uidl = 0;
 
       dprint (1, (debugfile, "pop_fetch_headers: unset UIDL capability\n"));
-      snprintf (pop_data->err_msg, sizeof (pop_data->err_msg),
+      snprintf (pop_data->err_msg, sizeof (pop_data->err_msg), "%s",
              _("Command UIDL is not supported by server."));
     }
   }
diff -r 093b0c6c6d86 -r 4e29b337e967 pop_auth.c
--- a/pop_auth.c        Wed May 31 16:19:22 2017 -0700
+++ b/pop_auth.c        Thu Jun 01 13:33:21 2017 -0700
@@ -274,7 +274,7 @@
       pop_data->cmd_user = 0;
 
       dprint (1, (debugfile, "pop_auth_user: unset USER capability\n"));
-      snprintf (pop_data->err_msg, sizeof (pop_data->err_msg),
+      snprintf (pop_data->err_msg, sizeof (pop_data->err_msg), "%s",
               _("Command USER is not supported by server."));
     }
   }

Reply via email to