From a915f1e69e1f363a9cb03a9400c9a80aea0aed86 Mon Sep 17 00:00:00 2001 From: Nate Bargmann Date: Mon, 5 Nov 2018 20:07:34 -0600 Subject: [PATCH] Quell clang6 warning of format string not a literal The warning was: CC rotctl_parse.o ../../hamlib/tests/rotctl_parse.c:1012:50: warning: format string is not a string literal (potentially insecure) [-Wformat-security] snprintf(cmd_name, sizeof(cmd_name), parsed_input[0] + 1); ^~~~~~~~~~~~~~~~~~~ ../../hamlib/tests/rotctl_parse.c:1012:50: note: treat the string as an argument to avoid this snprintf(cmd_name, sizeof(cmd_name), parsed_input[0] + 1); ^ "%s", 1 warning generated. --- tests/rotctl_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/rotctl_parse.c b/tests/rotctl_parse.c index 44308cceb..aab130006 100644 --- a/tests/rotctl_parse.c +++ b/tests/rotctl_parse.c @@ -1009,7 +1009,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc) /* The starting position of the source string is the first * character past the initial '\'. */ - snprintf(cmd_name, sizeof(cmd_name), parsed_input[0] + 1); + snprintf(cmd_name, sizeof(cmd_name), "%s", parsed_input[0] + 1); /* Sanity check as valid multiple character commands consist of * alpha-numeric characters and the underscore ('_') character.