rev |
line source |
al@20586
|
1 From 52093add7b3f38156e632fa81fcf1c0b6ad4d549 Mon Sep 17 00:00:00 2001
|
al@20586
|
2 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
al@20586
|
3 Date: Tue, 3 Dec 2013 15:11:14 +0100
|
al@20586
|
4 Subject: [PATCH] Pass compilation with -Wformat-security
|
al@20586
|
5 MIME-Version: 1.0
|
al@20586
|
6 Content-Type: text/plain; charset=UTF-8
|
al@20586
|
7 Content-Transfer-Encoding: 8bit
|
al@20586
|
8
|
al@20586
|
9 Signed-off-by: Petr Písař <ppisar@redhat.com>
|
al@20586
|
10 ---
|
al@20586
|
11 diff/diff3.c | 2 +-
|
al@20586
|
12 src/main.c | 2 +-
|
al@20586
|
13 src/subr.c | 12 ++++--------
|
al@20586
|
14 3 files changed, 6 insertions(+), 10 deletions(-)
|
al@20586
|
15
|
al@20586
|
16 diff --git a/diff/diff3.c b/diff/diff3.c
|
al@20586
|
17 index 006039f..e9418ce 100644
|
al@20586
|
18 --- a/diff/diff3.c
|
al@20586
|
19 +++ b/diff/diff3.c
|
al@20586
|
20 @@ -1505,7 +1505,7 @@ output_diff3 (diff, mapping, rev_mapping)
|
al@20586
|
21 line = 0;
|
al@20586
|
22 do
|
al@20586
|
23 {
|
al@20586
|
24 - printf_output (line_prefix);
|
al@20586
|
25 + printf_output ("%s", line_prefix);
|
al@20586
|
26 cp = D_RELNUM (ptr, realfile, line);
|
al@20586
|
27 length = D_RELLEN (ptr, realfile, line);
|
al@20586
|
28 write_output (cp, length);
|
al@20586
|
29 diff --git a/src/main.c b/src/main.c
|
al@20586
|
30 index 24a6e6f..e7f0439 100644
|
al@20586
|
31 --- a/src/main.c
|
al@20586
|
32 +++ b/src/main.c
|
al@20586
|
33 @@ -1154,6 +1154,6 @@ usage (cpp)
|
al@20586
|
34 {
|
al@20586
|
35 (void) fprintf (stderr, *cpp++, program_name, cvs_cmd_name);
|
al@20586
|
36 for (; *cpp; cpp++)
|
al@20586
|
37 - (void) fprintf (stderr, *cpp);
|
al@20586
|
38 + (void) fprintf (stderr, "%s", *cpp);
|
al@20586
|
39 error_exit ();
|
al@20586
|
40 }
|
al@20586
|
41 diff --git a/src/subr.c b/src/subr.c
|
al@20586
|
42 index 0725503..94907ce 100644
|
al@20586
|
43 --- a/src/subr.c
|
al@20586
|
44 +++ b/src/subr.c
|
al@20586
|
45 @@ -46,10 +46,8 @@ xmalloc (bytes)
|
al@20586
|
46 cp = malloc (bytes);
|
al@20586
|
47 if (cp == NULL)
|
al@20586
|
48 {
|
al@20586
|
49 - char buf[80];
|
al@20586
|
50 - sprintf (buf, "out of memory; can not allocate %lu bytes",
|
al@20586
|
51 - (unsigned long) bytes);
|
al@20586
|
52 - error (1, 0, buf);
|
al@20586
|
53 + error (1, 0, "out of memory; can not allocate %lu bytes",
|
al@20586
|
54 + (unsigned long) bytes);
|
al@20586
|
55 }
|
al@20586
|
56 return (cp);
|
al@20586
|
57 }
|
al@20586
|
58 @@ -73,10 +71,8 @@ xrealloc (ptr, bytes)
|
al@20586
|
59
|
al@20586
|
60 if (cp == NULL)
|
al@20586
|
61 {
|
al@20586
|
62 - char buf[80];
|
al@20586
|
63 - sprintf (buf, "out of memory; can not reallocate %lu bytes",
|
al@20586
|
64 - (unsigned long) bytes);
|
al@20586
|
65 - error (1, 0, buf);
|
al@20586
|
66 + error (1, 0, "out of memory; can not reallocate %lu bytes",
|
al@20586
|
67 + (unsigned long) bytes);
|
al@20586
|
68 }
|
al@20586
|
69 return (cp);
|
al@20586
|
70 }
|
al@20586
|
71 --
|
al@20586
|
72 1.8.3.1
|
al@20586
|
73
|