projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cbcdbc4
)
Simon Poole reports that awk segfaults when environment variables
author
Eric Andersen
<andersen@codepoet.org>
Fri, 30 Jul 2004 23:52:08 +0000
(23:52 -0000)
committer
Eric Andersen
<andersen@codepoet.org>
Fri, 30 Jul 2004 23:52:08 +0000
(23:52 -0000)
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
editors/awk.c
patch
|
blob
|
history
diff --git
a/editors/awk.c
b/editors/awk.c
index af895892563450477ebf9c6d0afddf19c7693020..c0e1a71fe3b3fae203af435ef41cf2592c6d7c96 100644
(file)
--- 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);
}