findpaths: bus errors in malloc
    jpn at teddy.UUCP 
    jpn at teddy.UUCP
       
    Fri Jan 23 07:00:11 AEST 1987
    
    
  
I was getting bus errors in malloc() when I ran "findpaths" (only sometimes).
I traced the bug down to this line:
	newftp->name = malloc(sizeof(file)+1);
This is WRONG, since file is declared as a (char *), it always allocates 3
bytes, instead of enough space to hold the string for the subsequent strcpy.
Change the "sizeof" to "strlen", and findpaths works great.
    
    
More information about the Comp.sources.bugs
mailing list