domain builder: Fix sanity check for gzip size.

Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2007-04-26 15:42:49 +01:00
1 parent 3ad25facec
commit faae093917
1 file changed
+2 -2
+2 -2
View File
@@ -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",
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.