WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATH] Fix overflow in xc_set_cpufreq_gov

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATH] Fix overflow in xc_set_cpufreq_gov
From: Jean Guyader <jean.guyader@xxxxxxxxxxxxx>
Date: Fri, 12 Dec 2008 12:17:50 +0000
Delivery-date: Fri, 12 Dec 2008 04:17:14 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724)

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

Signed-off-by: Jean Guyader <jean.guyader@xxxxxxxxxxxxx>

--
Jean Guyader
diff -r 68b76ad4faf7 tools/libxc/xc_pm.c
--- a/tools/libxc/xc_pm.c       Thu Dec 11 22:32:20 2008 +0000
+++ b/tools/libxc/xc_pm.c       Fri Dec 12 12:14:22 2008 +0000
@@ -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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATH] Fix overflow in xc_set_cpufreq_gov, Jean Guyader <=