From: Vincent Brillault Date: Thu, 21 Aug 2014 16:09:26 +0000 (+0200) Subject: Turbostat: replace sprintf with ssnprintf from common.h X-Git-Tag: collectd-5.5.0~24^2~77 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=f02b2733d7ae40b0c514a0c1979a86f28bbd45d4;hp=7623a947a3ef3902b41b6e08d213bd169d4f4505;p=collectd.git Turbostat: replace sprintf with ssnprintf from common.h --- 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);