Code

Fix integer overflow in unpack_compressed_entry()
authorIlari Liusvaara <ilari.liusvaara@elisanet.fi>
Tue, 26 Jan 2010 18:24:15 +0000 (20:24 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 26 Jan 2010 21:00:16 +0000 (13:00 -0800)
Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c

index a903247677bfe1d41a14f8f153d66494837c86b7..23d347c45fcf2a93ee59b9ddea996ec432038200 100644 (file)
@@ -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;