tools/power turbostat: fix possible sprintf buffer overflow
commit 46c2797826
upstream.
Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Alakesh Haloi <alakeshh@amazon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
pull/10/head
parent
cdb2d37d34
commit
3a738e7f73
|
@ -1485,7 +1485,7 @@ int get_mp(int cpu, struct msr_counter *mp, unsigned long long *counterp)
|
||||||
if (get_msr(cpu, mp->msr_num, counterp))
|
if (get_msr(cpu, mp->msr_num, counterp))
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
char path[128];
|
char path[128 + PATH_BYTES];
|
||||||
|
|
||||||
if (mp->flags & SYSFS_PERCPU) {
|
if (mp->flags & SYSFS_PERCPU) {
|
||||||
sprintf(path, "/sys/devices/system/cpu/cpu%d/%s",
|
sprintf(path, "/sys/devices/system/cpu/cpu%d/%s",
|
||||||
|
|
Loading…
Reference in New Issue