]> andersk Git - openssh.git/commitdiff
- (djm) dirname(3) may modify its argument on glibc and other systems.
authordjm <djm>
Wed, 11 Jul 2001 11:32:20 +0000 (11:32 +0000)
committerdjm <djm>
Wed, 11 Jul 2001 11:32:20 +0000 (11:32 +0000)
   Patch from markus@, spotted by Tom Holroyd <tomh@po.crl.go.jp>

ChangeLog
auth.c

index 5dd2de7b12fe9909fbf6972fffb444ff03867fbe..4e1a4c992be3c1dc906bb7ac2282c6801152d9be 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+20010711
+ - (djm) dirname(3) may modify its argument on glibc and other systems. 
+   Patch from markus@, spotted by Tom Holroyd <tomh@po.crl.go.jp>
+
 20010704
  - OpenBSD CVS Sync
    - markus@cvs.openbsd.org 2001/06/25 08:25:41
diff --git a/auth.c b/auth.c
index 84e0be76152647435eabea5c04a643cb46afe6ad..436802342372f9826507d7ca3d7390612c1cf2c9 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -368,7 +368,11 @@ secure_filename(FILE *f, const char *file, struct passwd *pw,
        char *cp;
        struct stat st;
 
-       strlcpy(homedir, dirname(pw->pw_dir), sizeof(homedir));
+       strlcpy(homedir, pw->pw_dir, sizeof(homedir));
+       if ((cp = dirname(homedir)) == NULL)
+               strlcpy(homedir, "/", sizeof(homedir));
+       else
+               memmove(homedir, cp, strlen(cp));
 
        if (realpath(file, buf) == NULL) {
                snprintf(err, errlen, "realpath %s failed: %s", file,
This page took 0.102309 seconds and 5 git commands to generate.