summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorIlari Liusvaara <ilari.liusvaara@elisanet.fi>2010-01-26 20:24:15 +0200
committerJunio C Hamano <gitster@pobox.com>2010-01-26 13:00:16 -0800
commit4ab07e4d1076a1b94b91d58913daeb20eb1c0e2d (patch)
treead39edebdaecdb6160f7659ccea26e8a2201a6b7 /sha1_file.c
parent3aee68aa68e80856de26340b707148d8f8d5b82e (diff)
downloadgit-4ab07e4d1076a1b94b91d58913daeb20eb1c0e2d.tar.gz
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>
Diffstat (limited to 'sha1_file.c')
-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;