[klibc] [PATCH v1 2/3] dash: shell: Fix clang warnings about format string
Bill Wendling
morbo at google.com
Mon Nov 9 14:13:35 PST 2020
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>
---
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)");
--
2.29.2.222.g5d2a92d10f8-goog
More information about the klibc
mailing list