From: Ilari Liusvaara Date: Tue, 26 Jan 2010 18:24:15 +0000 (+0200) Subject: Fix integer overflow in unpack_compressed_entry() X-Git-Tag: v1.7.0-rc1~25^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4ab07e4d1076a1b94b91d58913daeb20eb1c0e2d;p=git.git Fix integer overflow in unpack_compressed_entry() Signed-off-by: Ilari Liusvaara Signed-off-by: Junio C Hamano --- diff --git a/sha1_file.c b/sha1_file.c index a90324767..23d347c45 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1582,8 +1582,7 @@ static void *unpack_compressed_entry(struct packed_git *p, z_stream stream; unsigned char *buffer, *in; - buffer = xmalloc(size + 1); - buffer[size] = 0; + buffer = xmallocz(size); memset(&stream, 0, sizeof(stream)); stream.next_out = buffer; stream.avail_out = size + 1;