summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlari Liusvaara <ilari.liusvaara@elisanet.fi>2010-01-26 18:24:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-26 21:00:16 (GMT)
commit4ab07e4d1076a1b94b91d58913daeb20eb1c0e2d (patch)
treead39edebdaecdb6160f7659ccea26e8a2201a6b7
parent3aee68aa68e80856de26340b707148d8f8d5b82e (diff)
downloadgit-4ab07e4d1076a1b94b91d58913daeb20eb1c0e2d.zip
git-4ab07e4d1076a1b94b91d58913daeb20eb1c0e2d.tar.gz
git-4ab07e4d1076a1b94b91d58913daeb20eb1c0e2d.tar.bz2
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 a903247..23d347c 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;