Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | From 86b4d398dbb95e2437b70eba3b30e995ec9be505 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 31 Aug 2017 20:47:50 -0700 |
| 4 | Subject: [PATCH] Fix printd formatting strings |
| 5 | |
| 6 | Fixes |
| 7 | error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] |
| 8 | |
| 9 | Upstream-Status: Pending |
| 10 | |
| 11 | Signed-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 | |
| 17 | diff --git a/src/ipfilter.c b/src/ipfilter.c |
| 18 | index 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; |
| 30 | diff --git a/src/othptab.c b/src/othptab.c |
| 31 | index 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 | -- |
| 53 | 2.14.1 |
| 54 | |