summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-07-11 21:32:20 +1000
committerDamien Miller <djm@mindrot.org>2001-07-11 21:32:20 +1000
commiteec0c25f2a1704b871ceafff4c3cc96dd985b63b (patch)
treed3bcca317d084633d6596774e456d1849f9c6f61
parent024acc46e6d145708881b854c84b0eb879550c38 (diff)
- (djm) dirname(3) may modify its argument on glibc and other systems.
Patch from markus@, spotted by Tom Holroyd <tomh@po.crl.go.jp>
-rw-r--r--ChangeLog6
-rw-r--r--auth.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 18c8ff63e..bfe383aef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
120010711
2 - (djm) dirname(3) may modify its argument on glibc and other systems.
3 Patch from markus@, spotted by Tom Holroyd <tomh@po.crl.go.jp>
4
120010704 520010704
2 - OpenBSD CVS Sync 6 - OpenBSD CVS Sync
3 - markus@cvs.openbsd.org 2001/06/25 08:25:41 7 - markus@cvs.openbsd.org 2001/06/25 08:25:41
@@ -5968,4 +5972,4 @@
5968 - Wrote replacements for strlcpy and mkdtemp 5972 - Wrote replacements for strlcpy and mkdtemp
5969 - Released 1.0pre1 5973 - Released 1.0pre1
5970 5974
5971$Id: ChangeLog,v 1.1383 2001/07/05 04:27:20 tim Exp $ 5975$Id: ChangeLog,v 1.1384 2001/07/11 11:32:20 djm Exp $
diff --git a/auth.c b/auth.c
index 84e0be761..436802342 100644
--- a/auth.c
+++ b/auth.c
@@ -368,7 +368,11 @@ secure_filename(FILE *f, const char *file, struct passwd *pw,
368 char *cp; 368 char *cp;
369 struct stat st; 369 struct stat st;
370 370
371 strlcpy(homedir, dirname(pw->pw_dir), sizeof(homedir)); 371 strlcpy(homedir, pw->pw_dir, sizeof(homedir));
372 if ((cp = dirname(homedir)) == NULL)
373 strlcpy(homedir, "/", sizeof(homedir));
374 else
375 memmove(homedir, cp, strlen(cp));
372 376
373 if (realpath(file, buf) == NULL) { 377 if (realpath(file, buf) == NULL) {
374 snprintf(err, errlen, "realpath %s failed: %s", file, 378 snprintf(err, errlen, "realpath %s failed: %s", file,