aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xg_private.c
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-03-17 11:44:55 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-03-17 11:44:55 +0100
commit13134a9fddb42a0d3e2836ea292f24ea8540a92b (patch)
tree42f35eb60e08c766c96e39cf911281a93c445118 /tools/libxc/xg_private.c
parente21b3a393ee99da58409979f082fef6e799249fc (diff)
downloadxen-13134a9fddb42a0d3e2836ea292f24ea8540a92b.tar.gz
xen-13134a9fddb42a0d3e2836ea292f24ea8540a92b.tar.bz2
xen-13134a9fddb42a0d3e2836ea292f24ea8540a92b.zip
Fix the gzip size extraction in xc_inflate_buffer(). Extract
bytes as unsigned quantities. Signed-off-by: David Lively <dlively@virtualiron.com>
Diffstat (limited to 'tools/libxc/xg_private.c')
-rw-r--r--tools/libxc/xg_private.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/libxc/xg_private.c b/tools/libxc/xg_private.c
index 65aae5de50..d86b9b10b7 100644
--- a/tools/libxc/xg_private.c
+++ b/tools/libxc/xg_private.c
@@ -77,10 +77,11 @@ char *xc_inflate_buffer(const char *in_buf, unsigned long in_size,
return (char *)in_buf;
}
- out_len = in_buf[in_size-4] +
- (256 * (in_buf[in_size-3] +
- (256 * (in_buf[in_size-2] +
- (256 * in_buf[in_size-1])))));
+ out_len = (unsigned char)in_buf[in_size-4] +
+ (256 * ((unsigned char)in_buf[in_size-3] +
+ (256 * ((unsigned char)in_buf[in_size-2] +
+ (256 * (unsigned char)in_buf[in_size-1])))));
+
bzero(&zStream, sizeof(zStream));
out_buf = malloc(out_len + 16); /* Leave a little extra space */
if ( out_buf == NULL )