summaryrefslogtreecommitdiff
path: root/os/utils.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2011-10-17 22:27:35 +0200
committerMatthieu Herrb <matthieu.herrb@laas.fr>2011-10-18 15:58:00 +0200
commitb67581cf825940fdf52bf2e0af4330e695d724a4 (patch)
treefa7513611c3f4beedbb7c00123011946f03d7cb2 /os/utils.c
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>
Diffstat (limited to 'os/utils.c')
-rw-r--r--os/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/os/utils.c b/os/utils.c
index fe4925497..07cf4c24f 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);
/*