Validate the ws number for client assignment.

This commit is contained in:
Fernando Tarlá Cardoso Lemos 2010-08-27 20:54:41 -03:00 committed by Michael Stapelberg
parent 26c61850bd
commit 6cf7ac7655
1 changed files with 10 additions and 5 deletions

View File

@ -493,13 +493,18 @@ workspace_name:
assign: assign:
TOKASSIGN WHITESPACE window_class WHITESPACE optional_arrow assign_target TOKASSIGN WHITESPACE window_class WHITESPACE optional_arrow assign_target
{ {
printf("assignment of %s\n", $<string>3); DLOG("assignment of %s\n", $<string>3);
struct Assignment *new = $<assignment>6; struct Assignment *new = $<assignment>6;
printf(" to %d\n", new->workspace); if (new->floating != ASSIGN_FLOATING_ONLY && new->workspace < 1) {
printf(" floating = %d\n", new->floating); DLOG("Invalid client assignment, workspace number %d out of range\n", new->workspace);
new->windowclass_title = $<string>3; free(new);
TAILQ_INSERT_TAIL(&assignments, new, assignments); } else {
DLOG(" to %d\n", new->workspace);
DLOG(" floating = %d\n", new->floating);
new->windowclass_title = $<string>3;
TAILQ_INSERT_TAIL(&assignments, new, assignments);
}
} }
; ;