Index: x11-utils-7.6+4/xwininfo/dsimple.c =================================================================== --- x11-utils-7.6+4.orig/xwininfo/dsimple.c 2011-10-21 16:00:11.000000000 +1000 +++ x11-utils-7.6+4/xwininfo/dsimple.c 2012-07-24 16:20:47.053575611 +1000 @@ -120,6 +120,12 @@ if (screen) { /* find our screen */ const xcb_setup_t *setup = xcb_get_setup(*dpy); + int screen_count = xcb_setup_roots_length(setup); + if (screen_count <= screen_number) + { + Fatal_Error ("unable to access screen %d, max is %d", + screen_number, screen_count-1 ); + } xcb_screen_iterator_t screen_iter = xcb_setup_roots_iterator(setup); for (i = 0; i < screen_number; i++)