Skip to content

Commit

Permalink
Fix integer overflow in unpack_compressed_entry()
Browse files Browse the repository at this point in the history
Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ilari Liusvaara authored and Junio C Hamano committed Jan 26, 2010
1 parent 3aee68a commit 4ab07e4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4ab07e4

Please sign in to comment.