diff options
author | imp <imp@FreeBSD.org> | 1998-12-16 04:44:32 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1998-12-16 04:44:32 +0000 |
commit | 499ab4bd0d7a03de7b0513a6b6c515309f7e2f80 (patch) | |
tree | 856d6ec5b7a1dcf65496f4c10fc48bbd41b0f7c3 /bin | |
parent | a15b387ba9494284ef2acd6053a8c80d859088c6 (diff) | |
download | FreeBSD-src-499ab4bd0d7a03de7b0513a6b6c515309f7e2f80.zip FreeBSD-src-499ab4bd0d7a03de7b0513a6b6c515309f7e2f80.tar.gz |
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.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/csh/dir.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/csh/dir.c b/bin/csh/dir.c index f3b8b9d..b1fc00d 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) { |