mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 22:39:38 +00:00
Allocate enough memory for the terminator in commit parsing
Also allow space for the null-terminator when allocating the buffer in
packfile_unpack_compressed. Up to now, the last newline had served as
a terminator, but 858ef372
searches for a double-newline and exposes
the problem.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
This commit is contained in:
parent
37172582ec
commit
cdb6f9bf5e
@ -1246,7 +1246,8 @@ static int packfile_unpack_compressed(
|
|||||||
z_stream stream;
|
z_stream stream;
|
||||||
unsigned char *buffer, *in;
|
unsigned char *buffer, *in;
|
||||||
|
|
||||||
buffer = git__malloc(size);
|
buffer = git__malloc(size + 1);
|
||||||
|
memset(buffer, 0x0, size + 1);
|
||||||
|
|
||||||
memset(&stream, 0, sizeof(stream));
|
memset(&stream, 0, sizeof(stream));
|
||||||
stream.next_out = buffer;
|
stream.next_out = buffer;
|
||||||
|
Loading…
Reference in New Issue
Block a user