aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-08-31 10:21:25 +0100
committerDaniel Lezcano <daniel.lezcano@linaro.org>2016-09-08 12:46:43 +0200
commitcc965781d34287fbc0233f054691a3a51f2c7e29 (patch)
treeeff7226e90a691c8155fc6de47a690f8c636200a
parent31cc77aace22f9025f0bf8178914b3c8045276e6 (diff)
downloadidlestat-cc965781d34287fbc0233f054691a3a51f2c7e29.tar.gz
Fix TRACE_IPIIRQ_FORMAT string format width overflow scan issue
cppcheck detected a potential buffer overflow with a %s scanf width format specifier being larger than the destination buffer. Reduce the scan size to match the expected buffer size. Fixes error: [idlestat.c:974]: (error) Width 32 given in format string (no. 2) is larger than destination buffer 'irqname[17]', use %16s to prevent overflowing it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--idlestat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/idlestat.c b/idlestat.c
index f6a07e5..c956032 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -950,7 +950,7 @@ void output_cstate_info(FILE *f, struct cpu_topology * topo, int nrcpus)
}
#define TRACE_IRQ_FORMAT "%*[^[][%d] %*[^=]=%d%*[^=]=%16s"
-#define TRACE_IPIIRQ_FORMAT "%*[^[][%d] %*[^(](%32s"
+#define TRACE_IPIIRQ_FORMAT "%*[^[][%d] %*[^(](%16s"
#define TRACECMD_REPORT_FORMAT "%*[^]]] %lf:%*[^=]=%u%*[^=]=%d"
#define TRACE_FORMAT "%*[^]]] %*s %lf:%*[^=]=%u%*[^=]=%d"