]> git.sur5r.net Git - i3/i3/commitdiff
Validate the ws number for client assignment.
authorFernando Tarlá Cardoso Lemos <fernandotcl@gmail.com>
Fri, 27 Aug 2010 23:54:41 +0000 (20:54 -0300)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 1 Sep 2010 09:53:14 +0000 (11:53 +0200)
src/cfgparse.y

index 234e8fa7fbda1521a405394d5bd23217e84e5e83..3ba788a953ae6d79cd353382379ccc983d7507f7 100644 (file)
@@ -493,13 +493,18 @@ workspace_name:
 assign:
         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;
-                printf("  to %d\n", new->workspace);
-                printf("  floating = %d\n", new->floating);
-                new->windowclass_title = $<string>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 = $<string>3;
+                        TAILQ_INSERT_TAIL(&assignments, new, assignments);
+                }
         }
         ;