Skip to contentSkip to conversation

Fix overflow in xc_set_cpufreq_gov

PATH Jean Guyader 1 participant 1 message Dec 12, 2008

lore
Share & tools
lore
#0 lore raw

This fix an overflow on scaling_governor. Recent compilers fail on this kind of statements.

Signature · 1 line
Jean Guyader
tools/libxc/xc_pm.c +1 -1
diff -r 68b76ad4faf7 tools/libxc/xc_pm.c
@@ -285,7 +285,7 @@
     sysctl.u.pm_op.cmd = SET_CPUFREQ_GOV;
     sysctl.u.pm_op.cpuid = cpuid;
     strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN);
-    scaling_governor[CPUFREQ_NAME_LEN] = '\0';
+    scaling_governor[CPUFREQ_NAME_LEN - 1] = '\0';
 
     return xc_sysctl(xc_handle, &sysctl);
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel