aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Zhang Rui <rui.zhang@intel.com> 2023-01-12 14:43:37 +0800
committerGravatar Hans de Goede <hdegoede@redhat.com> 2023-02-03 09:57:05 +0100
commit689dfc9e40036cb74f30c0700905b44b2c935846 (patch)
tree01cf9b5fa45f475ee11807e3a0653081db7c84b9
parenttools/power/x86/intel-speed-select: Remove duplicate dup() (diff)
downloadlinux-689dfc9e40036cb74f30c0700905b44b2c935846.tar.gz
linux-689dfc9e40036cb74f30c0700905b44b2c935846.tar.bz2
linux-689dfc9e40036cb74f30c0700905b44b2c935846.zip
tools/power/x86/intel-speed-select: Use null-terminated string
strlen() and strtok() takes null-termimated strings as input. Make sure these strings are null-terminated before using them. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--tools/power/x86/intel-speed-select/isst-config.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
index b5822ee67cb3..b549e6f0946d 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -1583,6 +1583,7 @@ static int set_cpufreq_scaling_min_max_from_cpuinfo(int cpu, int cpuinfo_max, in
if (fd < 0)
return fd;
+ min_freq[15] = '\0';
len = strlen(min_freq);
ret = write(fd, min_freq, len);
if (ret == -1) {
@@ -2015,6 +2016,7 @@ static void set_fact_enable(int arg)
if (len < 0)
continue;
+ sibling_list[127] = '\0';
cpu_str = strtok(sibling_list, ",");
while (cpu_str != NULL) {
int cpu;