ia64/xen-unstable

changeset 14954:58205257517d

domain builder: Fix sanity check for gzip size.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Apr 26 15:42:49 2007 +0100 (2007-04-26)
parents d0acb5a3e8d8
children 16e38247dee8
files tools/libxc/xc_dom_core.c
line diff
     1.1 --- a/tools/libxc/xc_dom_core.c	Thu Apr 26 15:36:09 2007 +0100
     1.2 +++ b/tools/libxc/xc_dom_core.c	Thu Apr 26 15:42:49 2007 +0100
     1.3 @@ -209,13 +209,13 @@ size_t xc_dom_check_gzip(void *blob, siz
     1.4      unsigned char *gzlen;
     1.5      size_t unziplen;
     1.6  
     1.7 -    if (strncmp(blob, "\037\213", 2))
     1.8 +    if ( strncmp(blob, "\037\213", 2) )
     1.9          /* not gzipped */
    1.10          return 0;
    1.11  
    1.12      gzlen = blob + ziplen - 4;
    1.13      unziplen = gzlen[3] << 24 | gzlen[2] << 16 | gzlen[1] << 8 | gzlen[0];
    1.14 -    if ( (unziplen < ziplen) || (unziplen > (ziplen * 8)) )
    1.15 +    if ( (unziplen < 0) || (unziplen > (1024*1024*1024)) ) /* 1GB limit */
    1.16      {
    1.17          xc_dom_printf
    1.18              ("%s: size (zip %zd, unzip %zd) looks insane, skip gunzip\n",