]> git.sur5r.net Git - i3/i3/commitdiff
Sanity-check the stack-limit argument (limit needs to be > 0)
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 1 Sep 2010 12:31:25 +0000 (14:31 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 1 Sep 2010 12:31:25 +0000 (14:31 +0200)
src/cfgparse.y

index 3ba788a953ae6d79cd353382379ccc983d7507f7..790ae3be8a1f6541ec428c9d997214219d172b99 100644 (file)
@@ -393,18 +393,22 @@ new_container:
         }
         | TOKNEWCONTAINER WHITESPACE TOKSTACKLIMIT WHITESPACE TOKSTACKLIMIT WHITESPACE NUMBER
         {
-                DLOG("stack-limit %d with val %d\n", $<number>5, $<number>7);
-                config.container_stack_limit = $<number>5;
-                config.container_stack_limit_value = $<number>7;
-
-                /* See the comment above */
-                Workspace *ws;
-                TAILQ_FOREACH(ws, workspaces, workspaces) {
-                        if (ws->table == NULL)
-                                continue;
-                        Container *con = ws->table[0][0];
-                        con->stack_limit = config.container_stack_limit;
-                        con->stack_limit_value = config.container_stack_limit_value;
+                if ($<number>7 <= 0) {
+                        ELOG("Invalid stack-limit, need a limit which is > 0\n");
+                } else {
+                        DLOG("stack-limit %d with val %d\n", $<number>5, $<number>7);
+                        config.container_stack_limit = $<number>5;
+                        config.container_stack_limit_value = $<number>7;
+
+                        /* See the comment above */
+                        Workspace *ws;
+                        TAILQ_FOREACH(ws, workspaces, workspaces) {
+                                if (ws->table == NULL)
+                                        continue;
+                                Container *con = ws->table[0][0];
+                                con->stack_limit = config.container_stack_limit;
+                                con->stack_limit_value = config.container_stack_limit_value;
+                        }
                 }
         }
         ;