Fix integer overflow in unpack_compressed_entry()
Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ilari Liusvaara committed
Jan 26, 2010 at 20:24 UTC
4ab07e4d1076a1b94b91d58913daeb20eb1c0e2d
1 file changed
+1
-2
sha1_file.c
+1
-2
@@ -1582,8 +1582,7 @@ static void *unpack_compressed_entry(struct packed_git *p,
1582
z_stream stream;
1583
unsigned char *buffer, *in;
1584
1585
- buffer = xmalloc(size + 1);
1586
- buffer[size] = 0;
1585
+ buffer = xmallocz(size);
1586
memset(&stream, 0, sizeof(stream));
1587
stream.next_out = buffer;
1588
stream.avail_out = size + 1;