From 7d1e839e1ad28053220a2f240a5981093b76aee7 Mon Sep 17 00:00:00 2001 From: "Bernhard R. Link" Date: Thu, 23 Dec 2010 15:38:34 +0100 Subject: don't follow a pointer that might be NULL (HIDE_MOUSE specific) In events.c's key_press, the screen the local pointer variable s points to is accessed if HIDE_MOUSE is defined when hiding the cursor. Directly after that there is a "if (!s) return;", which is obviously too late. By default HIDE_MOUSE is not defined in src/conf.h, so this is not a problem unless this feature was enabled at compile time. Found by cppcheck. --- src/events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/events.c b/src/events.c index 6a229b8..0a5d759 100644 --- a/src/events.c +++ b/src/events.c @@ -447,12 +447,12 @@ key_press (XEvent *ev) else s = find_screen (ev->xkey.root); + if (!s) return; + #ifdef HIDE_MOUSE XWarpPointer (dpy, None, s->root, 0, 0, 0, 0, s->left + s->width - 2, s->top + s->height - 2); #endif - if (!s) return; - modifier = ev->xkey.state; cook_keycode ( &ev->xkey, &ks, &modifier, NULL, 0, 1); -- cgit v1.2.3