03247a4938
Approved-by: jlam
34 lines
1.2 KiB
Text
34 lines
1.2 KiB
Text
$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);
|
|
}
|
|
|