neocgit

a more 'modern' version of cgit
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/neocgit

commit 1b4ef6783a71962f8b5da3a23f2830f0f0f55ea0
parent 6d3c8bc37f6124c2193d66587079975d381aa435
Author: John Keeping <john@keeping.me.uk>
Date:   Sun, 19 Feb 2017 12:27:48 +0000

ui-shared: don't print path crumbs without a repo

cgit_print_path_crumbs() can call repolink() which assumes that ctx.repo
is non-null.  Currently we don't have any commands that set want_vpath
without also setting want_repo so it shouldn't be possible to fail this
test, but the check in cgit.c is in the wrong order so it is possible to
specify a query string like "?p=log&path=foo/bar" to end up here without
a valid repository.

This was found by American fuzzy lop [0].

[0] http://lcamtuf.coredump.cx/afl/

Signed-off-by: John Keeping <john@keeping.me.uk>

Diffstat:
Mui-shared.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui-shared.c b/ui-shared.c @@ -1039,7 +1039,7 @@ void cgit_print_pageheader(void) free(currenturl); } html("</td></tr></table>\n"); - if (ctx.env.authenticated && ctx.qry.vpath) { + if (ctx.env.authenticated && ctx.repo && ctx.qry.vpath) { html("<div class='path'>"); html("path: "); cgit_print_path_crumbs(ctx.qry.vpath);