sharutils does not build with -Werror=format-security

Santiago Vila <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
Hello.

The following patch is required to allow compilation of
sharutils 4.13.5 with -Werror=format-security.

Thanks.


From: Simon Ruderich <[email protected]>
Subject: Allow compilation with -Werror=format-security
Bug-Debian: http://bugs.debian.org/700313
X-Debian-version: 1:4.11.1-2

--- a/src/shar.c
+++ b/src/shar.c
@@ -461,7 +461,7 @@
 
   if (stat (local_name, &struct_stat))
     {
-      error (0, errno, local_name);
+      error (0, errno, "%s", local_name);
       return SHAR_EXIT_FILE_NOT_FOUND;
     }
 
@@ -470,7 +470,7 @@
 
   if (directory = opendir (local_name), !directory)
     {
-      error (0, errno, local_name);
+      error (0, errno, "%s", local_name);
       return SHAR_EXIT_CANNOT_OPENDIR;
     }
 
@@ -563,7 +563,7 @@
 #else
   if (closedir (directory))
     {
-      error (0, errno, local_name);
+      error (0, errno, "%s", local_name);
       return SHAR_EXIT_CANNOT_OPENDIR;
     }
 #endif
@@ -954,7 +954,7 @@
         free (c_dir);
       }
     else
-      error (0, errno, _("Cannot get current directory name"));
+      error (0, errno, "%s", _("Cannot get current directory name"));
   }
 }
 
@@ -2134,7 +2134,7 @@
        */
       FILE * fp = freopen ("/dev/null", fwriteonly_mode, stderr);
       if (fp != stderr)
-        error (SHAR_EXIT_FAILED, errno,
+        error (SHAR_EXIT_FAILED, errno, "%s",
                _("reopening stderr to /dev/null"));
     }
 
@@ -2200,7 +2200,7 @@
   if (HAVE_OPT(QUERY_USER))
     {
       if (HAVE_OPT(NET_HEADERS))
-	error (0, 0, _("PLEASE avoid -X shars on Usenet or public networks"));
+	error (0, 0, "%s", _("PLEASE avoid -X shars on Usenet or public networks"));
 
       fputs ("shar_wish=\n", output);
     }
@@ -2348,7 +2348,7 @@
               optionLoadLine (&sharOptions, arg);
             }
           else
-            error (0, errno, arg);
+            error (0, errno, "%s", arg);
           continue;
         }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.