klibc-bot for Bill Wendling
2020-Dec-12 23:27 UTC
[klibc] [klibc:master] dash: shell: Fix clang warnings about format string
Commit-ID: 11f41a418ad02e50b7f5a8768981c5a28cd9482d Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=11f41a418ad02e50b7f5a8768981c5a28cd9482d Author: Bill Wendling <morbo at google.com> AuthorDate: Mon, 9 Nov 2020 14:13:35 -0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 12 Dec 2020 22:46:25 +0100 [klibc] dash: shell: Fix clang warnings about format string Build with clang results in some warnings about using a non-string literal for a format string. ----------------------------------------------------------------------- usr/dash/jobs.c:429:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security] col = fmtstr(s, 32, strsignal(st)); ^~~~~~~~~~~~~ usr/dash/jobs.c:429:23: note: treat the string as an argument to avoid this col = fmtstr(s, 32, strsignal(st)); ^ "%s", ----------------------------------------------------------------------- Signed-off-by: Bill Wendling <morbo at google.com> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/jobs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/jobs.c b/usr/dash/jobs.c index b9ff1402..f027cc10 100644 --- a/usr/dash/jobs.c +++ b/usr/dash/jobs.c @@ -426,7 +426,7 @@ sprint_status(char *s, int status, int sigonly) goto out; #endif } - col = fmtstr(s, 32, strsignal(st)); + col = fmtstr(s, 32, "%s", strsignal(st)); #ifdef WCOREDUMP if (WCOREDUMP(status)) { col += fmtstr(s + col, 16, " (core dumped)");