]> git.cameronkatri.com Git - cgit.git/commitdiff
ui-shared: don't print path crumbs without a repo
authorJohn Keeping <john@keeping.me.uk>
Sun, 19 Feb 2017 12:27:48 +0000 (12:27 +0000)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 10 Aug 2017 14:05:07 +0000 (16:05 +0200)
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>
ui-shared.c

index 2e4fcd928d410378c7e88edcd9643496c84bade5..e5c9a02f9f08773eda336ba603ecd74edcf38953 100644 (file)
@@ -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);