diff options
author | Jason A. Donenfeld | 2016-02-26 13:14:43 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2016-02-26 13:14:52 +0100 |
commit | 09a3aa5ae7781a0e461373ede6bc10129cb3f5de (patch) | |
tree | 230930fd28ccf12883790d60142fb5421373c920 | |
parent | c424b5cb0253d8b55d3932efa51aa703dab2bf40 (diff) | |
download | cgit-09a3aa5ae7781a0e461373ede6bc10129cb3f5de.tar.gz cgit-09a3aa5ae7781a0e461373ede6bc10129cb3f5de.tar.bz2 cgit-09a3aa5ae7781a0e461373ede6bc10129cb3f5de.zip |
about: path_info might not be valid
-rw-r--r-- | cmd.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -39,9 +39,10 @@ static void atom_fn(void) | |||
39 | static void about_fn(void) | 39 | static void about_fn(void) |
40 | { | 40 | { |
41 | if (ctx.repo) { | 41 | if (ctx.repo) { |
42 | size_t path_info_len = ctx.env.path_info ? strlen(ctx.env.path_info) : 0; | ||
42 | if (!ctx.qry.path && | 43 | if (!ctx.qry.path && |
43 | ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' && | 44 | ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' && |
44 | ctx.env.path_info[strlen(ctx.env.path_info) - 1] != '/') { | 45 | (!path_info_len || ctx.env.path_info[path_info_len - 1] != '/')) { |
45 | char *currenturl = cgit_currenturl(); | 46 | char *currenturl = cgit_currenturl(); |
46 | char *redirect = fmtalloc("%s/", currenturl); | 47 | char *redirect = fmtalloc("%s/", currenturl); |
47 | cgit_redirect(redirect, true); | 48 | cgit_redirect(redirect, true); |