From: Fernando Tarlá Cardoso Lemos Date: Fri, 27 Aug 2010 23:54:41 +0000 (-0300) Subject: Validate the ws number for client assignment. X-Git-Tag: 3.e-bf2~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6cf7ac76556495d6a0c418bf470847a9f60fe79b;p=i3%2Fi3 Validate the ws number for client assignment. --- 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); + } } ;