From 09a3aa5ae7781a0e461373ede6bc10129cb3f5de Mon Sep 17 00:00:00 2001 From: Jason A. Donenfeld Date: Fri, 26 Feb 2016 13:14:43 +0100 Subject: about: path_info might not be valid --- cmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cmd.c') diff --git a/cmd.c b/cmd.c index 0375c5a..d280e95 100644 --- a/cmd.c +++ b/cmd.c @@ -39,9 +39,10 @@ static void atom_fn(void) 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); -- cgit v1.2.3-70-g09d2