libxc: check length on string copy (strcpy -> strncpy).
authorKeir Fraser <keir@xensource.com>
Tue, 23 Oct 2007 13:42:06 +0000 (14:42 +0100)
committerKeir Fraser <keir@xensource.com>
Tue, 23 Oct 2007 13:42:06 +0000 (14:42 +0100)
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
tools/libxc/xc_dom_boot.c

index e26941f7378a036d88b5a30778dbdb47c248c6ec..30906ee993de2e923ebe083a3253d862dd1b1268 100644 (file)
@@ -92,7 +92,9 @@ int xc_dom_compat_check(struct xc_dom_image *dom)
     char *item, *ptr;
     int match, found = 0;
 
-    strcpy(xen_caps, dom->xen_caps);
+    strncpy(xen_caps, dom->xen_caps, XEN_CAPABILITIES_INFO_LEN - 1);
+    xen_caps[XEN_CAPABILITIES_INFO_LEN - 1] = '\0';
+
     for ( item = strtok_r(xen_caps, " ", &ptr);
           item != NULL ; item = strtok_r(NULL, " ", &ptr) )
     {