[PATCH] xfree86: set a sane umask before opening the log

Julien Cristau jcristau at debian.org
Sat Nov 14 09:39:00 PST 2009


Xorg creates its log file following the umask of the user running
startx, which may result in a world-writable log.  Set umask to 022 to
prevent this.

Debian bug#555308 <http://bugs.debian.org/555308>
See also http://thread.gmane.org/gmane.comp.security.oss.general/2299

Signed-off-by: Julien Cristau <jcristau at debian.org>
---
 hw/xfree86/common/xf86Init.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 2d682aa..30f0c85 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1151,8 +1151,10 @@ OsVendorInit(void)
   signal(SIGCHLD, SIG_DFL);	/* Need to wait for child processes */
 #endif
 
-  if (!beenHere)
+  if (!beenHere) {
+    umask(022);
     xf86LogInit();
+  }
 
         /* Set stderr to non-blocking. */
 #ifndef O_NONBLOCK
-- 
1.6.5.2



More information about the xorg-devel mailing list