Skip to content

Commit 54c407a

Browse files
committed
ui-shared: restrict to 15 levels
Perhaps a more ideal version of this would be to not print breadcrumbs at all for paths that don't exist in the given repo at the given oid. Signed-off-by: Jason A. Donenfeld <[email protected]> Reported-by: Fydor Wire Snark <[email protected]>
1 parent bd0293f commit 54c407a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ui-shared.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,19 +945,21 @@ static void cgit_print_path_crumbs(char *path)
945945
{
946946
char *old_path = ctx.qry.path;
947947
char *p = path, *q, *end = path + strlen(path);
948+
int levels = 0;
948949

949950
ctx.qry.path = NULL;
950951
cgit_self_link("root", NULL, NULL);
951952
ctx.qry.path = p = path;
952953
while (p < end) {
953-
if (!(q = strchr(p, '/')))
954+
if (!(q = strchr(p, '/')) || levels > 15)
954955
q = end;
955956
*q = '\0';
956957
html_txt("/");
957958
cgit_self_link(p, NULL, NULL);
958959
if (q < end)
959960
*q = '/';
960961
p = q + 1;
962+
++levels;
961963
}
962964
ctx.qry.path = old_path;
963965
}

0 commit comments

Comments
 (0)