summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Ilari Liusvaara <ilari.liusvaara@elisanet.fi>2010-01-26 20:24:15 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-01-26 13:00:16 -0800
commit4ab07e4d1076a1b94b91d58913daeb20eb1c0e2d (patch)
treead39edebdaecdb6160f7659ccea26e8a2201a6b7
parentFix integer overflow in unpack_sha1_rest() (diff)
downloadtgif-4ab07e4d1076a1b94b91d58913daeb20eb1c0e2d.tar.xz
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>
-rw-r--r--sha1_file.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c
index a903247677..23d347c45f 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;