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.
This commit is contained in:
Nate Bargmann 2018-11-05 20:07:34 -06:00
parent 3a6f3bac96
commit a915f1e69e

View File

@ -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.