summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2011-10-17 22:27:35 +0200
committerJulien Cristau <jcristau@debian.org>2011-10-21 20:43:22 +0200
commit03ff880e8bf20cdecaf27f03391ea31545ecc22c (patch)
tree702a4faa3b5cf7cd362b7a7a5276225439d6578c
parent3394ae378da567025ac94a2c2ff04f2a0b113962 (diff)
Fix CVE-2011-4029: File permission change vulnerability.server-1.7-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) (cherry picked from commit 12f65819ffb04103f170ecd7e281348de618fc4c)
-rw-r--r--os/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/os/utils.c b/os/utils.c
index 7032227d8..adc75bc8f 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);
/*