[BusyBox-cvs] CVS update of busybox/editors (awk.c)

Erik Andersen andersen at codepoet.org
Fri Jul 30 23:52:09 UTC 2004


    Date: Friday, July 30, 2004 @ 17:52:09
  Author: andersen
    Path: /var/cvs/busybox/editors

Modified: awk.c (1.9 -> 1.10)

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


Index: busybox/editors/awk.c
diff -u busybox/editors/awk.c:1.9 busybox/editors/awk.c:1.10
--- busybox/editors/awk.c:1.9	Thu Jul 22 20:11:25 2004
+++ busybox/editors/awk.c	Fri Jul 30 17:52:08 2004
@@ -2670,8 +2670,12 @@
 	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);
 	}
 



More information about the busybox-cvs mailing list