summaryrefslogtreecommitdiff
path: root/x11/rxvt/patches/patch-am
diff options
context:
space:
mode:
Diffstat (limited to 'x11/rxvt/patches/patch-am')
-rw-r--r--x11/rxvt/patches/patch-am34
1 files changed, 34 insertions, 0 deletions
diff --git a/x11/rxvt/patches/patch-am b/x11/rxvt/patches/patch-am
new file mode 100644
index 00000000000..6819f36cf8f
--- /dev/null
+++ b/x11/rxvt/patches/patch-am
@@ -0,0 +1,34 @@
+$NetBSD: patch-am,v 1.1 2008/04/03 22:33:00 tonnerre Exp $
+
+Remove the default display :0 (solves CVE-2008-1142)
+
+--- src/init.c.orig 2002-12-04 06:21:39.000000000 +0100
++++ src/init.c
+@@ -532,14 +532,13 @@ rxvt_init_resources(rxvt_t *r, int argc,
+ /*
+ * 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);
+
+ #ifdef LOCAL_X_IS_UNIX
+- if (rs[Rs_display_name][0] == ':') {
++ if (rs[Rs_display_name] && rs[Rs_display_name][0] == ':') {
+ val = rxvt_malloc(5 + STRLEN(rs[Rs_display_name]));
+ STRCPY(val, "unix");
+ STRCAT(val, rs[Rs_display_name]);
+@@ -550,7 +549,9 @@ rxvt_init_resources(rxvt_t *r, int argc,
+
+ 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] : getenv("DISPLAY")?getenv("DISPLAY") :
++ "as no -display given and DISPLAY not set");
+ exit(EXIT_FAILURE);
+ }
+