From 6cf7ac76556495d6a0c418bf470847a9f60fe79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Tarl=C3=A1=20Cardoso=20Lemos?= Date: Fri, 27 Aug 2010 20:54:41 -0300 Subject: [PATCH] Validate the ws number for client assignment. --- src/cfgparse.y | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/cfgparse.y b/src/cfgparse.y index 234e8fa7..3ba788a9 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -493,13 +493,18 @@ workspace_name: assign: TOKASSIGN WHITESPACE window_class WHITESPACE optional_arrow assign_target { - printf("assignment of %s\n", $3); + DLOG("assignment of %s\n", $3); struct Assignment *new = $6; - printf(" to %d\n", new->workspace); - printf(" floating = %d\n", new->floating); - new->windowclass_title = $3; - TAILQ_INSERT_TAIL(&assignments, new, assignments); + if (new->floating != ASSIGN_FLOATING_ONLY && new->workspace < 1) { + DLOG("Invalid client assignment, workspace number %d out of range\n", new->workspace); + free(new); + } else { + DLOG(" to %d\n", new->workspace); + DLOG(" floating = %d\n", new->floating); + new->windowclass_title = $3; + TAILQ_INSERT_TAIL(&assignments, new, assignments); + } } ;