]> granicus.if.org Git - procps-ng/commitdiff
vmstat: Fixing format-security flaws
authorJaromir Capik <jcapik@redhat.com>
Wed, 5 Feb 2014 16:09:45 +0000 (17:09 +0100)
committerJaromir Capik <jcapik@redhat.com>
Wed, 5 Feb 2014 16:09:45 +0000 (17:09 +0100)
Previously the headers were printed directly without
the format specifier. That way is considered insecure
and leads to build errors with -Werror=format-security
flag set.

vmstat.c

index a84d2d27129f4c64e41453ca9bc88679fa195f5b..a2fd3512f29deda87ab8f12571f745cffcdfddc4 100644 (file)
--- a/vmstat.c
+++ b/vmstat.c
@@ -204,10 +204,10 @@ static void new_header(void)
            "%2s %2s %12s %12s %12s %12s %4s %4s %5s %5s %4s %4s %3s %3s %3s %3s %3s";
 
 
-       printf(w_option ? wide_header : header);
+       printf("%s", w_option ? wide_header : header);
 
        if (t_option) {
-               printf(timestamp_header);
+               printf("%s", timestamp_header);
        }
 
        printf("\n");
@@ -528,10 +528,10 @@ static void diskheader(void)
        const char wide_format[] =
            "%5s %9s %9s %11s %11s %9s %9s %11s %11s %7s %7s";
 
-       printf(w_option ? wide_header : header);
+       printf("%s", w_option ? wide_header : header);
 
        if (t_option) {
-               printf(timestamp_header);
+               printf("%s", timestamp_header);
        }
 
        printf("\n");