~sircmpwn/ctools

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH] env: fix potential NULL pointer dereference

Details
Message ID
<20191028013201.476966-1-chris@vittal.dev>
DKIM signature
missing
Download raw message
Patch: +1 -1
The two points where the elements of environ are accessed need to be
guarded with a NULL check. env can segfault otherwise.

---
Edited from Stefan Tatschner's original env patch.

 src/env.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/env.c b/src/env.c
index db86b97..f1a4520 100644
--- a/src/env.c
+++ b/src/env.c
@@ -57,7 +57,7 @@ main(int argc, char *argv[])

	/* No command, print the env */
	if (cmd_idx == argc) {
		for (int i = 0; environ[i]; i++) {
		for (int i = 0; environ && environ[i]; i++) {
			puts(environ[i]);
		}
		return 0;
-- 
2.23.0
Details
Message ID
<BY4NAV0BN6BA.2LRVZ85NGWMDV@homura>
In-Reply-To
<20191028013201.476966-1-chris@vittal.dev> (view parent)
DKIM signature
missing
Download raw message
Thanks!

To git.sr.ht:~sircmpwn/ctools
   599fbbb..3eec5b9  master -> master
Details
Message ID
<190d0c9d70d1c4a6e85dfce83add7f43f8118d48.camel@rumpelsepp.org>
In-Reply-To
<20191028013201.476966-1-chris@vittal.dev> (view parent)
DKIM signature
missing
Download raw message
Thanks for cleaning this up! I forgot to subscribe to the mailing list
and forgot about it.

S
Review patch Export thread (mbox)