From: Michael Stapelberg Date: Wed, 1 Sep 2010 12:31:25 +0000 (+0200) Subject: Sanity-check the stack-limit argument (limit needs to be > 0) X-Git-Tag: 4.0~43 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=53d6f476bc7289a9a69f8ccc9ff72c480734ada3;p=i3%2Fi3 Sanity-check the stack-limit argument (limit needs to be > 0) --- diff --git a/src/cfgparse.y b/src/cfgparse.y index 3ba788a9..790ae3be 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -393,18 +393,22 @@ new_container: } | TOKNEWCONTAINER WHITESPACE TOKSTACKLIMIT WHITESPACE TOKSTACKLIMIT WHITESPACE NUMBER { - DLOG("stack-limit %d with val %d\n", $5, $7); - config.container_stack_limit = $5; - config.container_stack_limit_value = $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 ($7 <= 0) { + ELOG("Invalid stack-limit, need a limit which is > 0\n"); + } else { + DLOG("stack-limit %d with val %d\n", $5, $7); + config.container_stack_limit = $5; + config.container_stack_limit_value = $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; + } } } ;