blob: 5b9afd961653c403a09ac4d20baf17b96c2c0a25 [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001From 86b4d398dbb95e2437b70eba3b30e995ec9be505 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 31 Aug 2017 20:47:50 -0700
4Subject: [PATCH] Fix printd formatting strings
5
6Fixes
7error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 src/ipfilter.c | 2 +-
14 src/othptab.c | 4 ++--
15 2 files changed, 3 insertions(+), 3 deletions(-)
16
17diff --git a/src/ipfilter.c b/src/ipfilter.c
18index eb17ec7..8c76e4c 100644
19--- a/src/ipfilter.c
20+++ b/src/ipfilter.c
21@@ -146,7 +146,7 @@ void gethostparams(struct hostparams *data, char *init_saddr, char *init_smask,
22 snprintf(msgstr, 60,
23 "Invalid protocol input at or near token \"%s\"",
24 bptr);
25- tui_error(ANYKEY_MSG, msgstr);
26+ tui_error(ANYKEY_MSG, "%s", msgstr);
27 doagain = 1;
28 } else
29 doagain = 0;
30diff --git a/src/othptab.c b/src/othptab.c
31index 142c9c2..fe395c2 100644
32--- a/src/othptab.c
33+++ b/src/othptab.c
34@@ -410,7 +410,7 @@ void printothpentry(struct othptable *table, struct othptabent *entry,
35 break;
36 }
37
38- sprintf(scratchpad, rarp_mac_addr);
39+ sprintf(scratchpad, "%s", rarp_mac_addr);
40 strcat(msgstring, scratchpad);
41 wattrset(table->othpwin, ARPATTR);
42 break;
43@@ -485,7 +485,7 @@ void printothpentry(struct othptable *table, struct othptabent *entry,
44 wattrset(table->othpwin, UNKNIPATTR);
45 protptr = getprotobynumber(entry->protocol);
46 if (protptr != NULL) {
47- sprintf(protname, protptr->p_aliases[0]);
48+ sprintf(protname, "%s", protptr->p_aliases[0]);
49 } else {
50 sprintf(protname, "IP protocol");
51 unknown = 1;
52--
532.14.1
54