Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jan 1997 14:07:36 +1100
From:      davidn@unique.usn.blaze.net.au (David Nugent)
To:        charnier@xp11.frmug.org ("Philippe Charnier")
Cc:        hackers@FreeBSD.org
Subject:   Re: unused variable in su
Message-ID:  <Mutt.19970111140736.davidn@labs.blaze.net.au>
In-Reply-To: <199701110142.CAA28453@xp11.frmug.org>; from "Philippe Charnier" on Jan 11, 1997 02:42:11 %2B0100
References:  <199701110142.CAA28453@xp11.frmug.org>

next in thread | previous in thread | raw e-mail | index | archive | help
"Philippe Charnier" writes:
> In /usr/src/usr.bin/su/su.c, I get:
> line 101: char shellbuf[MAXPATHLEN];
> line 171: shell = strcpy(shellbuf,  pwd->pw_shell);
> 
> Shellbuf is not referenced elsewhere, is there any reason not to
> remove shellbuf (and adjust line 171), or is there a side effect I don't
> see?

Yes, there certainly is a side-effect. You can't leave it
pointing to pwd->pw_dir, since that points to an internal
libc buffer which may be overwritten by a call to any getpw*()
function.


Regards,

David Nugent - Unique Computing Pty Ltd - Melbourne, Australia
Voice +61-3-9791-9547  Data/BBS +61-3-9792-3507  3:632/348@fidonet
davidn@freebsd.org davidn@blaze.net.au http://www.blaze.net.au/~davidn/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Mutt.19970111140736.davidn>