From 86b4d398dbb95e2437b70eba3b30e995ec9be505 Mon Sep 17 00:00:00 2001 From: Khem Raj 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 --- 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