diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-04-26 15:42:49 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-04-26 15:42:49 +0100 |
commit | faae093917b4e4fcce80124f003a4c56d081d155 (patch) | |
tree | af9ead930319a882641aa120895c50cceef41994 /tools/libxc | |
parent | 3ad25facec9b91d4fd178983ee53dde6c8ec4e44 (diff) | |
download | xen-faae093917b4e4fcce80124f003a4c56d081d155.tar.gz xen-faae093917b4e4fcce80124f003a4c56d081d155.tar.bz2 xen-faae093917b4e4fcce80124f003a4c56d081d155.zip |
domain builder: Fix sanity check for gzip size.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/libxc')
-rw-r--r-- | tools/libxc/xc_dom_core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c index d6b4d1d35a..c338498f08 100644 --- a/tools/libxc/xc_dom_core.c +++ b/tools/libxc/xc_dom_core.c @@ -209,13 +209,13 @@ size_t xc_dom_check_gzip(void *blob, size_t ziplen) unsigned char *gzlen; size_t unziplen; - if (strncmp(blob, "\037\213", 2)) + if ( strncmp(blob, "\037\213", 2) ) /* not gzipped */ return 0; gzlen = blob + ziplen - 4; unziplen = gzlen[3] << 24 | gzlen[2] << 16 | gzlen[1] << 8 | gzlen[0]; - if ( (unziplen < ziplen) || (unziplen > (ziplen * 8)) ) + if ( (unziplen < 0) || (unziplen > (1024*1024*1024)) ) /* 1GB limit */ { xc_dom_printf ("%s: size (zip %zd, unzip %zd) looks insane, skip gunzip\n", |