Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Stop terminating blobs git already terminates
Diffstat (limited to 'source')
-rw-r--r--source/ui-blob.c6
1 file changed, 2 insertions, 4 deletions
diff --git a/source/ui-blob.c b/source/ui-blob.c
index 0ea5141..0c90c42 100644
--- a/source/ui-blob.c
+++ b/source/ui-blob.c
@@ -134,9 +134,8 @@ int cgit_print_file(char *path, const char *head, int file_only, int html_escape
if (!buf)
return -1;
- // html_txt wants a terminated string, and git leaves a spare byte
- // past every object it reads, so this write stays in the allocation.
- buf[size] = '\0';
+ // html_txt wants a terminated string, which git leaves past every
+ // object it reads.
if (html_escape) {
// html_txt stops at a NUL, so a blob holding one is written
// segment by segment with a question mark standing in for
@@ -211,7 +210,6 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
return;
}
- buf[size] = '\0';
if (buffer_is_binary(buf, size))
ctx.page.mimetype = "application/octet-stream";
else