path: root/patch-delta.c
diff options
authorSergey Vlasov <>2005-09-04 09:43:16 (GMT)
committerJunio C Hamano <>2005-09-04 17:28:43 (GMT)
commitce726ec8d80ccce4e4956a026d807cb02bdc6de9 (patch)
tree9c3a45c485b1b368fd9d542abb5b52ce58063d34 /patch-delta.c
parent2ab141a26f93c4d97e243a6be8a38a7dd4eb35a3 (diff)
[PATCH] NUL terminate the object data in patch_delta()
At least pretty_print_commit() expects to get NUL-terminated commit data to work properly. unpack_sha1_rest(), which reads objects from separate files, and unpack_non_delta_entry(), which reads non-delta-compressed objects from pack files, already add the NUL byte after the object data, but patch_delta() did not do it, which caused problems with, e.g., git-rev-list --pretty when there are delta-compressed commit objects. Signed-off-by: Sergey Vlasov <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'patch-delta.c')
1 files changed, 2 insertions, 1 deletions
diff --git a/patch-delta.c b/patch-delta.c
index 26281ea..98c27be 100644
--- a/patch-delta.c
+++ b/patch-delta.c
@@ -34,9 +34,10 @@ void *patch_delta(void *src_buf, unsigned long src_size,
/* now the result size */
size = get_delta_hdr_size(&data);
- dst_buf = malloc(size);
+ dst_buf = malloc(size + 1);
if (!dst_buf)
return NULL;
+ dst_buf[size] = 0;
out = dst_buf;
while (data < top) {