diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2010-04-14 09:06:04 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2010-04-15 10:57:03 -0700 |
commit | fe7778e58e099d353689755ed2f5aa440569ebe3 (patch) | |
tree | 6e263f793233f254d75c3f6fc25e9a2d490cd13c /os | |
parent | 206531f75cd41c034e89fdfbc75ab0910682eef8 (diff) |
XQuartz: Fix possible NULL dereference in ListenOnOpenFD
<rdar://problem/7862319>
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Marc Majka <majka@apple.com>
Diffstat (limited to 'os')
-rw-r--r-- | os/connection.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/os/connection.c b/os/connection.c index 3ff93bbb6..61ba72a80 100644 --- a/os/connection.c +++ b/os/connection.c @@ -1253,10 +1253,11 @@ MakeClientGrabPervious(ClientPtr client) void ListenOnOpenFD(int fd, int noxauth) { char port[256]; XtransConnInfo ciptr; + const char *display_env = getenv("DISPLAY"); - if(!strncmp(getenv("DISPLAY"), "/tmp/launch", 11)) { + if(display_env && (strncmp(display_env, "/tmp/launch", 11) == 0)) { /* Make the path the launchd socket if our DISPLAY is set right */ - strcpy(port, getenv("DISPLAY")); + strcpy(port, display_env); } else { /* Just some default so things don't break and die. */ sprintf(port, ":%d", atoi(display)); |