From: Keir Fraser Date: Sat, 13 Dec 2008 15:04:53 +0000 (+0000) Subject: xc_pm: Fix off-by-one error in string array access. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14026^2~27 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0347bade8b442ad7dd19628c0ac3e509a6b786bf;p=xen.git xc_pm: Fix off-by-one error in string array access. Signed-off-by: Isaku Yamahata --- diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c index 6edb1a210f..3b2f314ca2 100644 --- a/tools/libxc/xc_pm.c +++ b/tools/libxc/xc_pm.c @@ -285,7 +285,7 @@ int xc_set_cpufreq_gov(int xc_handle, int cpuid, char *govname) 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); }