diff options
author | Eric Andersen | 2004-07-30 23:52:08 +0000 |
---|---|---|
committer | Eric Andersen | 2004-07-30 23:52:08 +0000 |
commit | 67776bef59096ff09cea39cb7c6e382b7c4f4a60 (patch) | |
tree | 0bd2be3d7957fba80b8aa9c82d0cb716cee90bad /editors/awk.c | |
parent | cbcdbc41ffab413767569891b58526b4d1066627 (diff) | |
download | busybox-67776bef59096ff09cea39cb7c6e382b7c4f4a60.zip busybox-67776bef59096ff09cea39cb7c6e382b7c4f4a60.tar.gz |
Simon Poole reports that awk segfaults when environment variables
with no value exist, i.e.
$ export BOB=''
% ./busybox awk
Segmentation fault
This patch teaches awk to not blow chunks on empty env variables.
-Erik
Diffstat (limited to 'editors/awk.c')
-rw-r--r-- | editors/awk.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/editors/awk.c b/editors/awk.c index af89589..c0e1a71 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -2670,8 +2670,12 @@ extern int awk_main(int argc, char **argv) { for (envp=environ; *envp; envp++) { s = bb_xstrdup(*envp); s1 = strchr(s, '='); + if (!s1) { + goto keep_going; + } *(s1++) = '\0'; setvar_u(findvar(iamarray(V[ENVIRON]), s), s1); +keep_going: free(s); } |