From 1ecf3e052d85ad600373b7f6e6e616c995391ad1 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:14:54 -0700 Subject: Trim a snapshot name without reading out of bounds For a url of .git, or an empty one, repo_basename stepped its index to the byte before its buffer, read it, and would have cleared it had it held a slash. Git's strbuf trims take the same steps safely, and they lift the 1024-byte cap that failed the page for a longer url. --- source/ui-shared.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/ui-shared.h') diff --git a/source/ui-shared.h b/source/ui-shared.h index da1b889..9abd4c0 100644 --- a/source/ui-shared.h +++ b/source/ui-shared.h @@ -125,7 +125,8 @@ extern void cgit_print_snapshot_links(const struct cgit_repo *repo, const char * /* * The name a snapshot of this repository is downloaded under, which is the - * configured prefix or the last component of the repository URL. + * configured prefix or the last component of the repository URL. A name taken + * from the URL is only good until the next call. */ extern const char *cgit_snapshot_prefix(const struct cgit_repo *repo); -- cgit