List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH] Fix segmentation fault in hc()
@ 2015-12-13  0:27 lfleischer
  2016-01-13 16:13 ` Jason
  0 siblings, 1 reply; 2+ messages in thread
From: lfleischer @ 2015-12-13  0:27 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Fix segmentation fault in hc()
  2015-12-13  0:27 [PATCH] Fix segmentation fault in hc() lfleischer
@ 2016-01-13 16:13 ` Jason
  0 siblings, 0 replies; 2+ messages in thread
From: Jason @ 2016-01-13 16:13 UTC (permalink / raw)


Good find! Thanks. Merged.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-13 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-13  0:27 [PATCH] Fix segmentation fault in hc() lfleischer
2016-01-13 16:13 ` Jason

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).