about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-08-31 13:35:28 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-08-31 13:35:28 +0000
commit50e4b4336299a09024f1e8361861ca939859279b (patch)
treea3b40beadc81040c8403164c6e85b6f9dbaf92b7 /Src
parentefed1e6c10daba9ea4260845a91f518f573ec1d3 (diff)
downloadzsh-50e4b4336299a09024f1e8361861ca939859279b.tar.gz
zsh-50e4b4336299a09024f1e8361861ca939859279b.tar.xz
zsh-50e4b4336299a09024f1e8361861ca939859279b.zip
25568: Frank Terbeck & pws: invalid continue and break arguments
also tests for control commands
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index ee44b3776..654665bfc 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4443,6 +4443,11 @@ bin_break(char *name, char **argv, UNUSED(Options ops), int func)
 	nump = 1;
     }
 
+    if (nump > 0 && (func == BIN_CONTINUE || func == BIN_BREAK) && num <= 0) {
+	zerrnam(name, "argument is not positive: %d", num);
+	return 1;
+    }
+
     switch (func) {
     case BIN_CONTINUE:
 	if (!loops) {   /* continue is only permitted in loops */