diff options
author | Matthieu Herrb <matthieu.herrb@laas.fr> | 2011-10-17 22:27:35 +0200 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-10-18 09:25:07 -0700 |
commit | 12f65819ffb04103f170ecd7e281348de618fc4c (patch) | |
tree | 4cc2404e8b1c638952858dc7aba8633e2fe71e15 | |
parent | f80d23357874db19bc124dee70239fb182977883 (diff) |
Fix CVE-2011-4029: File permission change vulnerability.
Use fchmod() to change permissions of the lock file instead
of chmod(), thus avoid the race that can be exploited to set
a symbolic link to any file or directory in the system.
Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit b67581cf825940fdf52bf2e0af4330e695d724a4)
-rw-r--r-- | os/utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/os/utils.c b/os/utils.c index 9e0acb616..d9aa65ec7 100644 --- a/os/utils.c +++ b/os/utils.c @@ -295,7 +295,7 @@ LockServer(void) FatalError("Could not create lock file in %s\n", tmp); (void) sprintf(pid_str, "%10ld\n", (long)getpid()); (void) write(lfd, pid_str, 11); - (void) chmod(tmp, 0444); + (void) fchmod(lfd, 0444); (void) close(lfd); /* |