From: Len Brown <len.brown@intel.com>
Date: Fri, 8 Dec 2017 17:38:17 -0500
Subject: tools/power turbostat: fix possible sprintf buffer overflow
Git-commit: 46c2797826cc6d1ae36fcbd966e76f9fa1907eef
Patch-mainline: v4.18-rc1
References: git-fixes
Signed-off-by: Len Brown <len.brown@intel.com>
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
tools/power/x86/turbostat/turbostat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 32f3a33a9850..59742600b7eb 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -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))
return -1;
} else {
- char path[128];
+ char path[128 + PATH_BYTES];
if (mp->flags & SYSFS_PERCPU) {
sprintf(path, "/sys/devices/system/cpu/cpu%d/%s",