From 3c8913bbc676603072b03d568438e5bbafbc83b4 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 06:09:53 -1000 Subject: Gate a readme ending in a colon like a disk path trust-scan-config passed any readme holding a colon as a tracked file, while the parser takes one only when a path follows the colon, so a scanned repository could still name a file on disk outside itself. The two now share one test. --- source/shared.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/shared.c') diff --git a/source/shared.c b/source/shared.c index befd3e5..6e69666 100644 --- a/source/shared.c +++ b/source/shared.c @@ -739,3 +739,10 @@ char *cgit_get_mimetype_for_filename(const char *filename) fclose(file); return NULL; } + +int cgit_readme_is_tracked(const char *readme) +{ + const char *colon = strchr(readme, ':'); + + return colon && colon[1]; +} -- cgit