diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Refuse pathspec magic in the feed as in the log
A feed path starting with a colon reached git as pathspec magic, so an
unknown magic word ended the request in a 500 and a known one changed
what the path matched, while the log answers both with a 400.
Diffstat (limited to '')
| -rw-r--r-- | source/ui-atom.c | 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 8 insertions, 0 deletions
diff --git a/source/ui-atom.c b/source/ui-atom.c index 39cadb8..0f82c0d 100644 --- a/source/ui-atom.c +++ b/source/ui-atom.c @@ -164,6 +164,14 @@ void cgit_print_atom(char *tip, const char *path, int max_count) int argc = 2; bool need_updated = true; + // A leading colon makes git read the path as a pathspec with magic, + // which can end the request inside git, so the feed refuses it as the + // log does. + if (path && path[0] == ':') { + cgit_print_error_page(400, "Bad Request", "Invalid path"); + return; + } + if (ctx.qry.show_all) argv[1] = "--all"; else if (!tip) |
