From 4ab07e4d1076a1b94b91d58913daeb20eb1c0e2d Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Tue, 26 Jan 2010 20:24:15 +0200 Subject: [PATCH] Fix integer overflow in unpack_compressed_entry() Signed-off-by: Ilari Liusvaara Signed-off-by: Junio C Hamano --- sha1_file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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; -- 2.30.2