diff options
author | Bernhard R. Link <brlink@debian.org> | 2010-12-23 15:38:34 +0100 |
---|---|---|
committer | Bernhard R. Link <brlink@debian.org> | 2010-12-23 15:46:13 +0100 |
commit | 7d1e839e1ad28053220a2f240a5981093b76aee7 (patch) | |
tree | deda3f2712fe3226454c377a9054f8b883c76e2a /src | |
parent | f4433c0dfca70186f83bd44f3eca365c06520b34 (diff) | |
download | ratpoison-7d1e839e1ad28053220a2f240a5981093b76aee7.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/events.c | 4 |
1 files 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); |