List for cgit developers and users
 help / color / mirror / Atom feed
From: normalperson at yhbt.net (Eric Wong)
Subject: [PATCH] ui-shared: fix segfault when defbranch is NULL
Date: Wed, 6 Jul 2016 07:08:01 +0000	[thread overview]
Message-ID: <20160706070801.GA13129@dcvr.yhbt.net> (raw)

Not sure if there's a better fix for this.  defbranch is
NULL here on my setup when a crawler hit an invalid URL,
causing strcmp to segfault.

Signed-off-by: Eric Wong <normalperson at yhbt.net>
---
 ui-shared.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui-shared.c b/ui-shared.c
index b1a6c46..e39d004 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -253,7 +253,7 @@ static char *repolink(const char *title, const char *class, const char *page,
 		}
 		delim = "&amp;";
 	}
-	if (head && strcmp(head, ctx.repo->defbranch)) {
+	if (head && ctx.repo->defbranch && strcmp(head, ctx.repo->defbranch)) {
 		html(delim);
 		html("h=");
 		html_url_arg(head);
-- 
EW


             reply	other threads:[~2016-07-06  7:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06  7:08 normalperson [this message]
2016-07-06  8:44 ` john
2016-07-06  9:29 ` 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=20160706070801.GA13129@dcvr.yhbt.net \
    --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).