summaryrefslogtreecommitdiffstats
path: root/import-layers/meta-openembedded/meta-oe/recipes-devtools/iptraf/iptraf-ng/0001-Fix-printd-formatting-strings.patch
blob: 5b9afd961653c403a09ac4d20baf17b96c2c0a25 (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
From 86b4d398dbb95e2437b70eba3b30e995ec9be505 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 31 Aug 2017 20:47:50 -0700
Subject: [PATCH] Fix printd formatting strings

Fixes
error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/ipfilter.c | 2 +-
 src/othptab.c  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/ipfilter.c b/src/ipfilter.c
index eb17ec7..8c76e4c 100644
--- a/src/ipfilter.c
+++ b/src/ipfilter.c
@@ -146,7 +146,7 @@ void gethostparams(struct hostparams *data, char *init_saddr, char *init_smask,
 				snprintf(msgstr, 60,
 					 "Invalid protocol input at or near token \"%s\"",
 					 bptr);
-				tui_error(ANYKEY_MSG, msgstr);
+				tui_error(ANYKEY_MSG, "%s", msgstr);
 				doagain = 1;
 			} else
 				doagain = 0;
diff --git a/src/othptab.c b/src/othptab.c
index 142c9c2..fe395c2 100644
--- a/src/othptab.c
+++ b/src/othptab.c
@@ -410,7 +410,7 @@ void printothpentry(struct othptable *table, struct othptabent *entry,
 				break;
 			}
 
-			sprintf(scratchpad, rarp_mac_addr);
+			sprintf(scratchpad, "%s", rarp_mac_addr);
 			strcat(msgstring, scratchpad);
 			wattrset(table->othpwin, ARPATTR);
 			break;
@@ -485,7 +485,7 @@ void printothpentry(struct othptable *table, struct othptabent *entry,
 		wattrset(table->othpwin, UNKNIPATTR);
 		protptr = getprotobynumber(entry->protocol);
 		if (protptr != NULL) {
-			sprintf(protname, protptr->p_aliases[0]);
+			sprintf(protname, "%s", protptr->p_aliases[0]);
 		} else {
 			sprintf(protname, "IP protocol");
 			unknown = 1;
-- 
2.14.1

OpenPOWER on IntegriCloud