From 969e9554a31385b2d2c09695dab984d585dc2693 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Mon, 21 Sep 2026 06:42:39 -1000 Subject: Harden the request path, scan and error recovery --- source/parsing.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'source/parsing.c') diff --git a/source/parsing.c b/source/parsing.c index 5fde25d..655973b 100644 --- a/source/parsing.c +++ b/source/parsing.c @@ -31,11 +31,9 @@ static char *substr(const char *start, const char *end) return buf; } -/* - * The repository's mailmap, read once per request and applied to every ident - * a page shows. Only the blob at HEAD is read, the way git reads a bare - * repository, so a repository cannot point the reader at a file on the server. - */ +// The repository's mailmap, read once per request and applied to every ident a +// page shows. Only the blob at HEAD is read, the way git reads a bare +// repository, so a repository cannot point the reader at a file on the server. static struct string_list mailmap = STRING_LIST_INIT_DUP; static int mailmap_read; @@ -175,7 +173,7 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) return info; if (!skip_prefix(p, "tree ", &p)) - die("Bad commit: %s", oid_to_hex(&commit->object.oid)); + die("Unable to parse commit %s", oid_to_hex(&commit->object.oid)); p += the_hash_algo->hexsz + 1; while (skip_prefix(p, "parent ", &p)) @@ -187,7 +185,8 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) } if (p && skip_prefix(p, "committer ", &p)) { - parse_user(p, &info->committer, &info->committer_email, &info->committer_date, &info->committer_tz); + parse_user(p, &info->committer, &info->committer_email, &info->committer_date, + &info->committer_tz); p = next_header_line(p); } @@ -247,9 +246,8 @@ struct taginfo *cgit_parse_tag(struct tag *tag) info = xcalloc(1, sizeof(struct taginfo)); for (p = data; !end_of_header(p); p = next_header_line(p)) { - if (skip_prefix(p, "tagger ", &p)) { + if (skip_prefix(p, "tagger ", &p)) parse_user(p, &info->tagger, &info->tagger_email, &info->tagger_date, &info->tagger_tz); - } } while (p && *p == '\n') -- cgit v2.8.0