aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jim.c4
-rw-r--r--regtest.tcl6
2 files changed, 10 insertions, 0 deletions
diff --git a/jim.c b/jim.c
index 08c448b..6e0cdb7 100644
--- a/jim.c
+++ b/jim.c
@@ -12292,6 +12292,10 @@ static int Jim_LsearchCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *
}
}
+ argc -= i;
+ if (argc < 2) {
+ goto wrongargs;
+ }
argv += i;
if (opt_all) {
diff --git a/regtest.tcl b/regtest.tcl
index a46b849..14ce59f 100644
--- a/regtest.tcl
+++ b/regtest.tcl
@@ -350,6 +350,12 @@ puts "TEST 50 PASSED"
catch {expr {2 && "abc$"}}
puts "TEST 51 PASSED"
+# REGTEST 52
+# lsearch -command with too few args
+catch {lsearch -all -command abc def}
+puts "TEST 52 PASSED"
+
+
# TAKE THE FOLLOWING puts AS LAST LINE
puts "--- ALL TESTS PASSED ---"