Skip to content

Commit 4ab07e4

Browse files
Ilari Liusvaaragitster
authored andcommitted
Fix integer overflow in unpack_compressed_entry()
Signed-off-by: Ilari Liusvaara <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3aee68a commit 4ab07e4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sha1_file.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,8 +1582,7 @@ static void *unpack_compressed_entry(struct packed_git *p,
15821582
z_stream stream;
15831583
unsigned char *buffer, *in;
15841584

1585-
buffer = xmalloc(size + 1);
1586-
buffer[size] = 0;
1585+
buffer = xmallocz(size);
15871586
memset(&stream, 0, sizeof(stream));
15881587
stream.next_out = buffer;
15891588
stream.avail_out = size + 1;

0 commit comments

Comments
 (0)