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>2016-02-26 15:14:43 +0300
committerJason A. Donenfeld <Jason@zx2c4.com>2016-02-26 15:14:52 +0300
commit09a3aa5ae7781a0e461373ede6bc10129cb3f5de (patch)
tree230930fd28ccf12883790d60142fb5421373c920
parentc424b5cb0253d8b55d3932efa51aa703dab2bf40 (diff)
about: path_info might not be valid
-rw-r--r--cmd.c3
1 files changed, 2 insertions, 1 deletions
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);