From e72b6653628f7aa7bf59c2d42365e967fce685be Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Mon, 17 Oct 2011 22:26:12 +0200 Subject: [PATCH] Fix CVE-2011-4028: File disclosure vulnerability. use O_NOFOLLOW to open the existing lock file, so symbolic links aren't followed, thus avoid revealing if it point to an existing file. Signed-off-by: Matthieu Herrb Reviewed-by: Alan Coopersmith (cherry picked from commit 6ba44b91e37622ef8c146d8f2ac92d708a18ed34) --- os/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/utils.c b/os/utils.c index fc72787ef..fad72b412 100644 --- a/os/utils.c +++ b/os/utils.c @@ -327,7 +327,7 @@ LockServer(void) /* * Read the pid from the existing file */ - lfd = open(LockFile, O_RDONLY); + lfd = open(LockFile, O_RDONLY|O_NOFOLLOW); if (lfd < 0) { unlink(tmp); FatalError("Can't read lock file %s\n", LockFile);