awk seg faults

Denis Vlasenko vda.linux at googlemail.com
Thu May 3 15:59:08 PDT 2007


On Thursday 03 May 2007 08:15, Daniel Ng wrote:
> This seems to be another case of awk seg faulting. 
>  
> On my system, I only need to type 'awk' on the command line to reproduce this symptom: 
>  
> Line 2660 of awk.c. The body of the for() loop never gets to execute because 
> envp is NULL and so *envp causes the seg fault: 
>  
> 2660: for (envp=environ; *envp; envp++) { 
> 2661: s = bb_xstrdup(*envp); 
> 2662: s1 = strchr(s, '='); 
> 2663: if (!s1) { 
> 2664: goto keep_going; 
> 2665: } 
>  
> If I change line 2660 to: 
>  
> for (envp=environ;( envp && (*envp) ); envp++) { 
>  
> -it doesn't seg fault anymore. 

Fixed. Thanks!

> Can someone explain why envp is NULL in the first place? 

I am surprised too.
--
vda


More information about the busybox mailing list