summaryrefslogtreecommitdiff
blob: e817f8d0e3160ce0e8101d5a09b6fde87bca2df6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# CVE-2008-1142 (rxvt 2.6.4 opens an xterm on :0 if the DISPLAY environment variable is not set, which might allow local users to hijack X11 connections.)
# Based on http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=41;filename=diff;att=1;bug=469296
# bug 217819

diff -Naur rxvt-2.7.10.orig/rclock/rclock.c rxvt-2.7.10/rclock/rclock.c
--- rxvt-2.7.10.orig/rclock/rclock.c	2008-05-03 14:23:07.264082222 +0200
+++ rxvt-2.7.10/rclock/rclock.c	2008-05-03 14:24:55.433082735 +0200
@@ -324,9 +324,6 @@
        CheckMaildir();
 #endif
 
-   if ((display_name = getenv ("DISPLAY")) == NULL)
-     display_name = ":0";
-
    /* parse the command line */
    for (i = 1; i < argc; i += 2)
      {
@@ -424,7 +421,9 @@
    Xdisplay = XOpenDisplay (display_name);
    if (!Xdisplay)
      {
-	print_error ("can't open display %s", display_name);
+	print_error ("can't open display %s", display_name?display_name:
+			getenv("DISPLAY")?getenv("DISPLAY"):
+			"as no -d given and DISPLAY not set");
 	goto Abort;
      }
 
diff -Naur rxvt-2.7.10.orig/src/init.c rxvt-2.7.10/src/init.c
--- rxvt-2.7.10.orig/src/init.c	2008-05-03 14:23:07.247082766 +0200
+++ rxvt-2.7.10/src/init.c	2008-05-03 14:43:44.705227631 +0200
@@ -532,8 +532,7 @@
 /*
  * Open display, get options/resources and create the window
  */
-    if ((rs[Rs_display_name] = getenv("DISPLAY")) == NULL)
-	rs[Rs_display_name] = ":0";
+    rs[Rs_display_name] = getenv("DISPLAY");
 
     rxvt_get_options(r, r_argc, r_argv);
     free(r_argv);
@@ -550,7 +549,9 @@
 
     if (r->Xdisplay == NULL
 	&& (r->Xdisplay = XOpenDisplay(rs[Rs_display_name])) == NULL) {
-	rxvt_print_error("can't open display %s", rs[Rs_display_name]);
+	rxvt_print_error("can't open display %s",
+			rs[Rs_display_name]?rs[Rs_display_name]:
+			"as no -display option given and DISPLAY not set");
 	exit(EXIT_FAILURE);
     }