From fb68d036b82a8b740eb9dc124b473fd97e810586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 12 Nov 2021 16:41:52 +0100 Subject: [PATCH] policycoreutils: use string literal as format strings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use string literal as format string so that compilers can validate the count and types of the inherent arguments. sestatus.c: In function ‘printf_tab’: sestatus.c:175:16: error: format not a string literal, argument types not checked [-Werror=format-nonliteral] 175 | printf(buf, outp); | ^~~ Signed-off-by: Christian Göttsche --- policycoreutils/sestatus/sestatus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/policycoreutils/sestatus/sestatus.c b/policycoreutils/sestatus/sestatus.c index ceee0d52..538c73bc 100644 --- a/policycoreutils/sestatus/sestatus.c +++ b/policycoreutils/sestatus/sestatus.c @@ -170,9 +170,7 @@ void load_checks(char *pc[], int *npc, char *fc[], int *nfc) void printf_tab(const char *outp) { - char buf[20]; - snprintf(buf, sizeof(buf), "%%-%us", COL); - printf(buf, outp); + printf("%-*s", COL, outp); }