From 50e4b4336299a09024f1e8361861ca939859279b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 31 Aug 2008 13:35:28 +0000 Subject: 25568: Frank Terbeck & pws: invalid continue and break arguments also tests for control commands --- Src/builtin.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Src') 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 */ -- cgit 1.4.1