aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>1998-12-16 04:44:32 +0000
committerWarner Losh <imp@FreeBSD.org>1998-12-16 04:44:32 +0000
commit0fd975510fdc4b5b85e7b192b9b3f315efa4ea96 (patch)
tree58ace809657b23d305f2e29b49e3acc2a26bdde1
parenta4324714a9da4dbb693d2a090337b1ed824009a3 (diff)
downloadsrc-0fd975510fdc4b5b85e7b192b9b3f315efa4ea96.tar.gz
src-0fd975510fdc4b5b85e7b192b9b3f315efa4ea96.zip
Use getcwd in stead of using getwd so that we try harder to avoid
overflowing a buffer. Obtained from: Either OpenBSD or a discussion in bugtraq.
Notes
Notes: svn path=/head/; revision=41843
-rw-r--r--bin/csh/dir.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/csh/dir.c b/bin/csh/dir.c
index f3b8b9d542b7..b1fc00d79f91 100644
--- a/bin/csh/dir.c
+++ b/bin/csh/dir.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)dir.c 8.1 (Berkeley) 5/31/93";
#else
static const char rcsid[] =
- "$Id: dir.c,v 1.7 1997/08/07 21:42:05 steve Exp $";
+ "$Id: dir.c,v 1.8 1998/06/09 03:38:37 imp Exp $";
#endif
#endif /* not lint */
@@ -85,7 +85,7 @@ dinit(hp)
static char *emsg = "csh: Trying to start from \"%s\"\n";
/* Don't believe the login shell home, because it may be a symlink */
- tcp = getwd(path); /* see ngetwd.c for System V version */
+ tcp = getcwd(path, MAXPATHLEN); /* see ngetwd.c for System V version */
if (tcp == NULL || *tcp == '\0') {
(void) fprintf(csherr, "csh: %s: %s\n", path, strerror(errno));
if (hp && *hp) {