all repos — cgit @ 09a3aa5ae7781a0e461373ede6bc10129cb3f5de

a hyperfast web frontend for git written in c

about: path_info might not be valid
Jason A. Donenfeld Jason@zx2c4.com
Fri, 26 Feb 2016 13:14:43 +0100
commit

09a3aa5ae7781a0e461373ede6bc10129cb3f5de

parent

c424b5cb0253d8b55d3932efa51aa703dab2bf40

1 files changed, 2 insertions(+), 1 deletions(-)

jump to
M cmd.ccmd.c

@@ -39,9 +39,10 @@

static void about_fn(void) { if (ctx.repo) { + size_t path_info_len = ctx.env.path_info ? strlen(ctx.env.path_info) : 0; if (!ctx.qry.path && ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' && - ctx.env.path_info[strlen(ctx.env.path_info) - 1] != '/') { + (!path_info_len || ctx.env.path_info[path_info_len - 1] != '/')) { char *currenturl = cgit_currenturl(); char *redirect = fmtalloc("%s/", currenturl); cgit_redirect(redirect, true);