summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2ab141a)
raw | patch | inline | side by side (parent: 2ab141a)
author | Sergey Vlasov <vsu@altlinux.ru> | |
Sun, 4 Sep 2005 09:43:16 +0000 (13:43 +0400) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 4 Sep 2005 17:28:43 +0000 (10:28 -0700) |
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 <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
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 <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
patch-delta.c | patch | blob | history |
diff --git a/patch-delta.c b/patch-delta.c
index 26281ea1230f730931442bc0ed59966a6f4031be..98c27beb252420102de78e50994ed5cc5b6f564a 100644 (file)
--- a/patch-delta.c
+++ b/patch-delta.c
/* 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) {