Subject: Problem with csh freeing stack/heap...
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: None <cagney@highland.oz.au>
List: current-users
Date: 05/18/1994 18:41:47
Hi,

I found this long ago in NetBSD-0.9 (while compiling AUIS 5.1) it seems
the problem is still there (NetBSD-current ~2nd May).

Unfortunatly, I've since deleted the bit of shell script that could
tickle the problem.  Oops :-(

Any way, in `dir.c:dinit()' the variable `tcp' is either set to an automatic
buffer `getwd(path)' or part of the environment space `getenv("PWD")' and then
passed to dcanon() vis:

	cp = dcanon(str2short(tcp), STRNULL);

dir.c:dcanon() then free's it's first argument (here tcp) ...

The patch below fixed the problem in NetBSD 0.9.

				Andrew


bash$ diff -c src/bin/csh/dir.c.dist src/bin/csh/dir.c
*** src/bin/csh/dir.c.dist      Sun Feb  6 01:44:54 1994
--- src/bin/csh/dir.c   Sun Feb  6 01:45:34 1994
***************
*** 123,129 ****
                    swd.st_ino == shp.st_ino)
                    tcp = cwd;
            }
!           cp = dcanon(str2short(tcp), STRNULL);
        }
      }
  
--- 123,129 ----
                    swd.st_ino == shp.st_ino)
                    tcp = cwd;
            }
!           cp = dcanon(SAVE(tcp), STRNULL);
        }
      }
	 
bash$ 

------------------------------------------------------------------------------