diff options
| -rw-r--r-- | pkg/shell/interpreter.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/shell/interpreter.go b/pkg/shell/interpreter.go index 6c1a89a..c222de0 100644 --- a/pkg/shell/interpreter.go +++ b/pkg/shell/interpreter.go @@ -17,6 +17,7 @@ import ( ) const COMMENT_STR = "#" +const STACK_LIMIT = 256 type keywords struct { commands []string @@ -177,6 +178,9 @@ out: for i := len(tokens) - 1; i >= 0; i-- { t := tokens[i] top := len(stack) - 1 + if top >= STACK_LIMIT { + return false, fmt.Errorf("Stack Limit of %d exceeded", STACK_LIMIT) + } switch t.Type { case ITOK_CMD_HELP: printHelp(w) |
