List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH] segfault fix on some bogus requests
@ 2012-01-04  9:01 normalperson
  2012-03-18  9:13 ` hjemli
  0 siblings, 1 reply; 2+ messages in thread
From: normalperson @ 2012-01-04  9:01 UTC (permalink / raw)


ctx.qry.head can be NULL in some cases due to bad requests
by weird bots.  I managed to reproduce with:

   PATH_INFO=/repo.git/shop.php QUERY_STRING=id=

Signed-off-by: Eric Wong <normalperson at yhbt.net>
---
 ui-shared.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui-shared.c b/ui-shared.c
index 3e9282f..d7d75bf 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -294,7 +294,7 @@ void cgit_log_link(const char *name, const char *title, const char *class,
 	char *delim;
 
 	delim = repolink(title, class, "log", head, path);
-	if (rev && strcmp(rev, ctx.qry.head)) {
+	if (rev && ctx.qry.head && strcmp(rev, ctx.qry.head)) {
 		html(delim);
 		html("id=");
 		html_url_arg(rev);
@@ -338,7 +338,7 @@ void cgit_commit_link(char *name, const char *title, const char *class,
 	char *delim;
 
 	delim = repolink(title, class, "commit", head, path);
-	if (rev && strcmp(rev, ctx.qry.head)) {
+	if (rev && ctx.qry.head && strcmp(rev, ctx.qry.head)) {
 		html(delim);
 		html("id=");
 		html_url_arg(rev);
-- 
Eric Wong




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

* [PATCH] segfault fix on some bogus requests
  2012-01-04  9:01 [PATCH] segfault fix on some bogus requests normalperson
@ 2012-03-18  9:13 ` hjemli
  0 siblings, 0 replies; 2+ messages in thread
From: hjemli @ 2012-03-18  9:13 UTC (permalink / raw)


On Wed, Jan 4, 2012 at 10:01, Eric Wong <normalperson at yhbt.net> wrote:
> ctx.qry.head can be NULL in some cases due to bad requests
> by weird bots.

Thanks, applied to stable.

--
larsh




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

end of thread, other threads:[~2012-03-18  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-04  9:01 [PATCH] segfault fix on some bogus requests normalperson
2012-03-18  9:13 ` hjemli

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