From d551ab8e5cfb00fbb7a79e7f0c3f4f2780fc6824 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 15 Jan 2016 11:33:41 +0000 Subject: [PATCH] Clear the environment properly by looping until it is empty rather than looping over it (which may skip entries), from Brad King. --- environ.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/environ.c b/environ.c index de560896..101dfafd 100644 --- a/environ.c +++ b/environ.c @@ -196,10 +196,10 @@ void environ_push(struct environ *env) { struct environ_entry *envent; - char **vp, *v; + char *v; - for (vp = environ; *vp != NULL; vp++) { - v = xstrdup(*vp); + while (*environ != NULL) { + v = xstrdup(*environ); v[strcspn(v, "=")] = '\0'; unsetenv(v);