From: lfleischer at lfos.de (Lukas Fleischer)
Subject: [PATCH] Fix segmentation fault in hc()
Date: Sun, 13 Dec 2015 01:27:13 +0100 [thread overview]
Message-ID: <1449966433-23375-1-git-send-email-lfleischer@lfos.de> (raw)
The ctx.qry.page variable might be unset at this point, e.g. when an
invalid command is passed and cgit_print_pageheader() is called to show
an error message.
Signed-off-by: Lukas Fleischer <lfleischer at lfos.de>
---
ui-shared.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ui-shared.c b/ui-shared.c
index c04f380..6b78b91 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -889,6 +889,9 @@ void cgit_add_hidden_formfields(int incl_head, int incl_search,
static const char *hc(const char *page)
{
+ if (!ctx.qry.page)
+ return NULL;
+
return strcmp(ctx.qry.page, page) ? NULL : "active";
}
--
2.6.4
next reply other threads:[~2015-12-13 0:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-13 0:27 lfleischer [this message]
2016-01-13 16:13 ` Jason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449966433-23375-1-git-send-email-lfleischer@lfos.de \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).