Don't honor $HOME if >= MAXPATHLEN

Obtained from:	Todd Miller <millert@openbsd.org> (OpenBSD csh.c rev 1.3 and 1.4)
This commit is contained in:
Eivind Eklund 1997-10-07 16:27:48 +00:00
parent ff2daf7bfc
commit 13a71f5d9b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=30206

View File

@ -42,13 +42,14 @@ static const char copyright[] =
static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
#else
static const char rcsid[] =
"$Id: csh.c,v 1.9 1997/08/07 21:42:03 steve Exp $";
"$Id: csh.c,v 1.10 1997/08/08 00:49:25 steve Exp $";
#endif
#endif /* not lint */
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <fcntl.h>
#include <errno.h>
#include <pwd.h>
@ -232,7 +233,7 @@ main(argc, argv)
*/
set(STRstatus, Strsave(STR0));
if ((tcp = getenv("HOME")) != NULL)
if ((tcp = getenv("HOME")) != NULL && strlen(tcp) < MAXPATHLEN)
cp = SAVE(tcp);
else
cp = NULL;