From: Denis Vlasenko Date: Thu, 3 May 2007 22:57:56 +0000 (-0000) Subject: awk: guard against empty environment X-Git-Tag: 1_6_0~96 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f71d916b60079f2009a714e49cb3e83efedbfb77;p=oweals%2Fbusybox.git awk: guard against empty environment --- diff --git a/editors/awk.c b/editors/awk.c index 5a504d034..bc9e99a6f 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -2696,7 +2696,8 @@ int awk_main(int argc, char **argv) newfile("/dev/stdout")->F = stdout; newfile("/dev/stderr")->F = stderr; - for (envp = environ; *envp; envp++) { + /* Huh, people report that sometimes environ is NULL. Oh well. */ + if (environ) for (envp = environ; *envp; envp++) { char *s = xstrdup(*envp); char *s1 = strchr(s, '='); if (s1) {