From 3c40f0682f3da2d5bde8a0f4626e979735434cc2 Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Mon, 9 Jul 2012 22:25:22 +0300 Subject: rework client_to_desktop function - check bounds --- monsterwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monsterwm.c b/monsterwm.c index 8fbf554..ba56bf1 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -240,7 +240,7 @@ void cleanup(void) { * add the current client as the last on the new desktop * and then remove it from the current desktop */ void client_to_desktop(const Arg *arg) { - if (arg->i == currdeskidx || !desktops[currdeskidx].curr) return; + if (arg->i == currdeskidx || arg->i < 0 || arg->i >= DESKTOPS || !desktops[currdeskidx].curr) return; Desktop *d = &desktops[currdeskidx], *n = &desktops[arg->i]; Client *p = prevclient(d->curr, d), *l = prevclient(n->head, n); -- cgit v1.3.1