From: Alan Cox Date: Thu, 20 Nov 2014 23:36:59 +0000 (+0000) Subject: putenv: Fix NULL environment handling X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=6915de64078aeb2ec14cce2da49218d00acec707;p=FUZIX.git putenv: Fix NULL environment handling From: Will Sowerbutts --- diff --git a/Library/libs/putenv.c b/Library/libs/putenv.c index 6547ffab..06cbcd0a 100644 --- a/Library/libs/putenv.c +++ b/Library/libs/putenv.c @@ -21,7 +21,7 @@ static int extras; if( r == 0 ) len = strlen(var); else len = r-var; - for(p=environ; *p; p++) + for(p=environ; p && *p; p++) { if( memcmp(var, *p, len) == 0 && (*p)[len] == '=' ) {