summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/patch/patch/0001-Make-it-build-with-compile-time-hardening-enabled.patch
blob: 31d86326f934081fa98927b7649503eba85bbfc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
From eae20c82ee6eb2f50482f7c90baaf001240ed084 Mon Sep 17 00:00:00 2001
From: Peter Kjellerstedt <pkj@axis.com>
Date: Thu, 26 Apr 2018 02:15:43 +0200
Subject: [PATCH] Make it build with compile time hardening enabled

This avoids the following errors:

  patch.c: In function 'apply_hunk':
  patch.c:1179:7: error: format not a string literal and no format
  arguments [-Werror=format-security]
         fprintf (fp, outstate->after_newline + else_defined);
         ^~~~~~~
  patch.c:1198:7: error: format not a string literal and no format
  arguments [-Werror=format-security]
         fprintf (fp, outstate->after_newline + else_defined);
         ^~~~~~~
  patch.c:1246:3: error: format not a string literal and no format
  arguments [-Werror=format-security]
     fprintf (fp, outstate->after_newline + else_defined);
     ^~~~~~~
  patch.c:1265:3: error: format not a string literal and no format
  arguments [-Werror=format-security]
     fprintf (fp, outstate->after_newline + end_defined);
     ^~~~~~~
  patch.c:1283:3: error: format not a string literal and no format
  arguments [-Werror=format-security]
     fprintf (fp, outstate->after_newline + else_defined);
     ^~~~~~~
  patch.c:1302:2: error: format not a string literal and no format
  arguments [-Werror=format-security]
    fprintf (fp, outstate->after_newline + end_defined);
    ^~~~~~~

Upstream-Status: Inappropriate [legacy version]
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 patch.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/patch.c b/patch.c
index 0d9a196..5e663a6 100644
--- a/patch.c
+++ b/patch.c
@@ -1176,7 +1176,7 @@ apply_hunk (struct outstate *outstate, LINENUM where)
 		    def_state = IN_IFNDEF;
 		}
 		else if (def_state == IN_IFDEF) {
-		    fprintf (fp, outstate->after_newline + else_defined);
+		    fprintf (fp, "%s", outstate->after_newline + else_defined);
 		    def_state = IN_ELSE;
 		}
 		if (ferror (fp))
@@ -1195,7 +1195,7 @@ apply_hunk (struct outstate *outstate, LINENUM where)
 		return false;
 	    if (R_do_defines) {
 		if (def_state == IN_IFNDEF) {
-		    fprintf (fp, outstate->after_newline + else_defined);
+		    fprintf (fp, "%s", outstate->after_newline + else_defined);
 		    def_state = IN_ELSE;
 		}
 		else if (def_state == OUTSIDE) {
@@ -1243,7 +1243,7 @@ apply_hunk (struct outstate *outstate, LINENUM where)
 	    while (pch_char (old) == '!');
 
 	    if (R_do_defines) {
-		fprintf (fp, outstate->after_newline + else_defined);
+		fprintf (fp, "%s", outstate->after_newline + else_defined);
 		if (ferror (fp))
 		  write_fatal ();
 		def_state = IN_ELSE;
@@ -1262,7 +1262,7 @@ apply_hunk (struct outstate *outstate, LINENUM where)
 	    old++;
 	    new++;
 	    if (R_do_defines && def_state != OUTSIDE) {
-		fprintf (fp, outstate->after_newline + end_defined);
+		fprintf (fp, "%s", outstate->after_newline + end_defined);
 		if (ferror (fp))
 		  write_fatal ();
 		outstate->after_newline = true;
@@ -1280,7 +1280,7 @@ apply_hunk (struct outstate *outstate, LINENUM where)
 		def_state = IN_IFDEF;
 	    }
 	    else if (def_state == IN_IFNDEF) {
-		fprintf (fp, outstate->after_newline + else_defined);
+		fprintf (fp, "%s", outstate->after_newline + else_defined);
 		def_state = IN_ELSE;
 	    }
 	    if (ferror (fp))
@@ -1299,7 +1299,7 @@ apply_hunk (struct outstate *outstate, LINENUM where)
 	while (new <= pat_end && pch_char (new) == '+');
     }
     if (R_do_defines && def_state != OUTSIDE) {
-	fprintf (fp, outstate->after_newline + end_defined);
+	fprintf (fp, "%s", outstate->after_newline + end_defined);
 	if (ferror (fp))
 	  write_fatal ();
 	outstate->after_newline = true;