List for cgit developers and users
 help / color / mirror / Atom feed
From: cgit at cryptocrack.de (Lukas Fleischer)
Subject: [PATCH 2/2] shared.c: Only setenv() if value is non-null
Date: Fri, 22 Jul 2011 17:15:50 +0200	[thread overview]
Message-ID: <1311347750-7126-3-git-send-email-cgit@cryptocrack.de> (raw)
In-Reply-To: <1311347750-7126-1-git-send-email-cgit@cryptocrack.de>

Some setenv() implementations (e.g. the one in OpenBSD's stdlib)
segfault if we pass a NULL value. Add an additional check to avoid this.

Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
---
 shared.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/shared.c b/shared.c
index 75c4b5c..0c8ce3e 100644
--- a/shared.c
+++ b/shared.c
@@ -392,7 +392,7 @@ void cgit_prepare_repo_env(struct cgit_repo * repo)
 	p = env_vars;
 	q = p + env_var_count;
 	for (; p < q; p++)
-		if (setenv(p->name, p->value, 1))
+		if (p->value && setenv(p->name, p->value, 1))
 			fprintf(stderr, warn, p->name, p->value);
 }
 
-- 
1.7.6





  parent reply	other threads:[~2011-07-22 15:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22 15:15 [PATCH 0/2] Compatibility fixes for non-Linux platforms cgit
2011-07-22 15:15 ` [PATCH 1/2] shared.c: Remove unused "linux/limits.h" include cgit
2012-01-03 15:04   ` hjemli
2011-07-22 15:15 ` cgit [this message]
2011-07-26 11:18   ` [PATCH 2/2] shared.c: Only setenv() if value is non-null mailings
2011-07-26 13:32     ` cgit
2011-07-26 14:24       ` mailings
2011-07-26 14:48         ` cgit
2011-07-26 16:15           ` mailings
2011-07-26 16:39             ` cgit
2011-09-14  7:09               ` hjemli
2011-09-14  7:37                 ` mailings
2011-09-14  9:52   ` [PATCH] " cgit
2012-01-03 15:06     ` hjemli
2012-01-03 15:13       ` mailings
2011-07-22 15:19 ` [PATCH 0/2] Compatibility fixes for non-Linux platforms cgit

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=1311347750-7126-3-git-send-email-cgit@cryptocrack.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).