From c6ee7bcc96b1bc9d2ac8b3a9000b5fbc49063f64 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:20:47 -0700 Subject: Stop terminating blobs git already terminates --- source/ui-blob.c | 6 ++---- 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 -- cgit