a14f230
From 52093add7b3f38156e632fa81fcf1c0b6ad4d549 Mon Sep 17 00:00:00 2001
a14f230
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
a14f230
Date: Tue, 3 Dec 2013 15:11:14 +0100
a14f230
Subject: [PATCH] Pass compilation with -Wformat-security
a14f230
MIME-Version: 1.0
a14f230
Content-Type: text/plain; charset=UTF-8
a14f230
Content-Transfer-Encoding: 8bit
a14f230
a14f230
Signed-off-by: Petr Písař <ppisar@redhat.com>
a14f230
---
a14f230
 diff/diff3.c |  2 +-
a14f230
 src/main.c   |  2 +-
a14f230
 src/subr.c   | 12 ++++--------
a14f230
 3 files changed, 6 insertions(+), 10 deletions(-)
a14f230
a14f230
diff --git a/diff/diff3.c b/diff/diff3.c
a14f230
index 006039f..e9418ce 100644
a14f230
--- a/diff/diff3.c
a14f230
+++ b/diff/diff3.c
a14f230
@@ -1505,7 +1505,7 @@ output_diff3 (diff, mapping, rev_mapping)
a14f230
 	      line = 0;
a14f230
 	      do
a14f230
 		{
a14f230
-		  printf_output (line_prefix);
a14f230
+		  printf_output ("%s", line_prefix);
a14f230
 		  cp = D_RELNUM (ptr, realfile, line);
a14f230
 		  length = D_RELLEN (ptr, realfile, line);
a14f230
 		  write_output (cp, length);
a14f230
diff --git a/src/main.c b/src/main.c
a14f230
index 24a6e6f..e7f0439 100644
a14f230
--- a/src/main.c
a14f230
+++ b/src/main.c
a14f230
@@ -1154,6 +1154,6 @@ usage (cpp)
a14f230
 {
a14f230
     (void) fprintf (stderr, *cpp++, program_name, cvs_cmd_name);
a14f230
     for (; *cpp; cpp++)
a14f230
-	(void) fprintf (stderr, *cpp);
a14f230
+	(void) fprintf (stderr, "%s", *cpp);
a14f230
     error_exit ();
a14f230
 }
a14f230
diff --git a/src/subr.c b/src/subr.c
a14f230
index 0725503..94907ce 100644
a14f230
--- a/src/subr.c
a14f230
+++ b/src/subr.c
a14f230
@@ -46,10 +46,8 @@ xmalloc (bytes)
a14f230
     cp = malloc (bytes);
a14f230
     if (cp == NULL)
a14f230
     {
a14f230
-	char buf[80];
a14f230
-	sprintf (buf, "out of memory; can not allocate %lu bytes",
a14f230
-		 (unsigned long) bytes);
a14f230
-	error (1, 0, buf);
a14f230
+	error (1, 0, "out of memory; can not allocate %lu bytes",
a14f230
+		(unsigned long) bytes);
a14f230
     }
a14f230
     return (cp);
a14f230
 }
a14f230
@@ -73,10 +71,8 @@ xrealloc (ptr, bytes)
a14f230
 
a14f230
     if (cp == NULL)
a14f230
     {
a14f230
-	char buf[80];
a14f230
-	sprintf (buf, "out of memory; can not reallocate %lu bytes",
a14f230
-		 (unsigned long) bytes);
a14f230
-	error (1, 0, buf);
a14f230
+	error (1, 0, "out of memory; can not reallocate %lu bytes",
a14f230
+		(unsigned long) bytes);
a14f230
     }
a14f230
     return (cp);
a14f230
 }
a14f230
-- 
a14f230
1.8.3.1
a14f230