From f02b2733d7ae40b0c514a0c1979a86f28bbd45d4 Mon Sep 17 00:00:00 2001 From: Vincent Brillault Date: Thu, 21 Aug 2014 18:09:26 +0200 Subject: [PATCH] Turbostat: replace sprintf with ssnprintf from common.h --- src/turbostat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/turbostat.c b/src/turbostat.c index 128950c0..a003ca83 100644 --- a/src/turbostat.c +++ b/src/turbostat.c @@ -273,7 +273,7 @@ get_msr(int cpu, off_t offset, unsigned long long *msr) char pathname[32]; int fd; - sprintf(pathname, "/dev/cpu/%d/msr", cpu); + ssnprintf(pathname, 32, "/dev/cpu/%d/msr", cpu); fd = open(pathname, O_RDONLY); if (fd < 0) return -1; @@ -640,7 +640,7 @@ get_num_ht_siblings(int cpu) int matches; char character; - sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu); + ssnprintf(path, 80, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu); filep = fopen(path, "r"); if (!filep) { ERROR("%s: open failed", path); -- 2.11.0