summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2011-10-17 20:27:35 (GMT)
committerMatthieu Herrb <matthieu.herrb@laas.fr>2011-10-18 13:58:00 (GMT)
commitb67581cf825940fdf52bf2e0af4330e695d724a4 (patch)
treefa7513611c3f4beedbb7c00123011946f03d7cb2
parent6ba44b91e37622ef8c146d8f2ac92d708a18ed34 (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>
-rw-r--r--os/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/os/utils.c b/os/utils.c
index fe49254..07cf4c2 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -297,7 +297,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);
/*