提交 46c27978 编写于 作者: L Len Brown

tools/power turbostat: fix possible sprintf buffer overflow

Signed-off-by: NLen Brown <len.brown@intel.com>
上级 fd3933ca
...@@ -1529,7 +1529,7 @@ int get_mp(int cpu, struct msr_counter *mp, unsigned long long *counterp) ...@@ -1529,7 +1529,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",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册