diff options
author | Matthieu Herrb <matthieu.herrb@laas.fr> | 2011-10-17 22:27:35 +0200 |
---|---|---|
committer | Julien Cristau <jcristau@debian.org> | 2011-10-29 18:59:32 +0200 |
commit | 630e4c93865ab892eec09d475d22596bbd8bd6fc (patch) | |
tree | 1a3eb8c8a0ebdbae2cfbc0d5829f42c2355caf8a | |
parent | 4185af737d7ae9aeb90893ef93343f4672f3222c (diff) |
Fix CVE-2011-4029: File permission change vulnerability.server-1.8-branch
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 3b6c7cda5..917b34fa9 100644 --- a/os/utils.c +++ b/os/utils.c @@ -315,7 +315,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); /* |