ia64/xen-unstable

changeset 16198:8f33d2c6c67c

libxc: check length on string copy (strcpy -> strncpy).
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
author Keir Fraser <keir@xensource.com>
date Tue Oct 23 14:42:06 2007 +0100 (2007-10-23)
parents b3fa9b58a102
children 47ad9f54e74b
files tools/libxc/xc_dom_boot.c
line diff
     1.1 --- a/tools/libxc/xc_dom_boot.c	Tue Oct 23 14:38:47 2007 +0100
     1.2 +++ b/tools/libxc/xc_dom_boot.c	Tue Oct 23 14:42:06 2007 +0100
     1.3 @@ -92,7 +92,9 @@ int xc_dom_compat_check(struct xc_dom_im
     1.4      char *item, *ptr;
     1.5      int match, found = 0;
     1.6  
     1.7 -    strcpy(xen_caps, dom->xen_caps);
     1.8 +    strncpy(xen_caps, dom->xen_caps, XEN_CAPABILITIES_INFO_LEN - 1);
     1.9 +    xen_caps[XEN_CAPABILITIES_INFO_LEN - 1] = '\0';
    1.10 +
    1.11      for ( item = strtok_r(xen_caps, " ", &ptr);
    1.12            item != NULL ; item = strtok_r(NULL, " ", &ptr) )
    1.13      {