mirror of
https://github.com/sheumann/hush.git
synced 2024-10-05 12:54:51 +00:00
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
This commit is contained in:
parent
cbcdbc41ff
commit
67776bef59
@ -2670,8 +2670,12 @@ extern int awk_main(int argc, char **argv) {
|
|||||||
for (envp=environ; *envp; envp++) {
|
for (envp=environ; *envp; envp++) {
|
||||||
s = bb_xstrdup(*envp);
|
s = bb_xstrdup(*envp);
|
||||||
s1 = strchr(s, '=');
|
s1 = strchr(s, '=');
|
||||||
|
if (!s1) {
|
||||||
|
goto keep_going;
|
||||||
|
}
|
||||||
*(s1++) = '\0';
|
*(s1++) = '\0';
|
||||||
setvar_u(findvar(iamarray(V[ENVIRON]), s), s1);
|
setvar_u(findvar(iamarray(V[ENVIRON]), s), s1);
|
||||||
|
keep_going:
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user