dce@smsc.sony.com (David Elliott) (09/05/90)
Sorry folks, but I couldn't find the right person to send rn
patches to, so I'm posting this here.
Under SVR4, getwd() is emulated using getcwd() with a constant buffer
size of 1024. The problem is that not all of the buffers used are 1024
bytes. On BSD, this doesn't pose a problem because of the way getwd()
is implemented (using a temporary buffer). In System V, the buffer is
updated in place, so not having 1024-byte buffers causes random memory
to get overwritten. In our case, part of the PATH environment variable
got screwed up(!).
*** ngstuff.c.orig Wed Jul 18 11:45:33 1990
--- ngstuff.c Tue Sep 4 17:58:31 1990
***************
*** 44,50 ****
register char *s;
bool interactive = (buf[1] == FINISHCMD);
bool docd;
! char whereiam[256];
if (!finish_command(interactive)) /* get remainder of command */
return -1;
--- 44,50 ----
register char *s;
bool interactive = (buf[1] == FINISHCMD);
bool docd;
! char whereiam[1024];
if (!finish_command(interactive)) /* get remainder of command */
return -1;
***************
*** 105,111 ****
#endif
else {
bool docd = (instr(buf,"-d") != Nullch);
! char whereami[256];
if (docd)
getwd(whereami);
--- 105,111 ----
#endif
else {
bool docd = (instr(buf,"-d") != Nullch);
! char whereami[1024];
if (docd)
getwd(whereami);
*** sw.c.orig Tue Sep 4 18:00:26 1990
--- sw.c Tue Sep 4 17:57:03 1990
***************
*** 467,473 ****
void
cwd_check()
{
! char tmpbuf[LBUFLEN];
if (!cwd)
cwd = savestr(filexp("~/News"));
--- 467,473 ----
void
cwd_check()
{
! char tmpbuf[1024];
if (!cwd)
cwd = savestr(filexp("~/News"));
--
...David Elliott
...dce@smsc.sony.com | ...!{uunet,mips}!sonyusa!dce
...(408)944-4073
...Krusty says: Give a hoot, read a book!