Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.zx2c4.com/cgit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-20 22:45:12 +0300
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-20 22:53:16 +0300
commit54c407a74a35d4ee9ffae94cc5bc9096c9f7f54a (patch)
tree2bb3e863ea5ceb8f06e541b62a17bef305adbfd9 /ui-shared.c
parentbd0293f57015ede637b630fcaf4fc11e7697d777 (diff)
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 <Jason@zx2c4.com> Reported-by: Fydor Wire Snark <wsnark@tuta.io>
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c
index d27a5fd..d2358f2 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -945,12 +945,13 @@ static void cgit_print_path_crumbs(char *path)
{
char *old_path = ctx.qry.path;
char *p = path, *q, *end = path + strlen(path);
+ int levels = 0;
ctx.qry.path = NULL;
cgit_self_link("root", NULL, NULL);
ctx.qry.path = p = path;
while (p < end) {
- if (!(q = strchr(p, '/')))
+ if (!(q = strchr(p, '/')) || levels > 15)
q = end;
*q = '\0';
html_txt("/");
@@ -958,6 +959,7 @@ static void cgit_print_path_crumbs(char *path)
if (q < end)
*q = '/';
p = q + 1;
+ ++levels;
}
ctx.qry.path = old_path;
}