summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclIndexObj.c6
-rw-r--r--tests/proc.test5
2 files changed, 9 insertions, 2 deletions
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index 5b367d6..76c2dea 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -954,7 +954,8 @@ Tcl_WrongNumArgs(
len = TclScanElement(elementStr, elemLen, &flags);
if (MAY_QUOTE_WORD && len != elemLen) {
- char *quotedElementStr = TclStackAlloc(interp, (unsigned)len);
+ char *quotedElementStr = TclStackAlloc(interp,
+ (unsigned)len + 1);
len = TclConvertElement(elementStr, elemLen,
quotedElementStr, flags);
@@ -1009,7 +1010,8 @@ Tcl_WrongNumArgs(
len = TclScanElement(elementStr, elemLen, &flags);
if (MAY_QUOTE_WORD && len != elemLen) {
- char *quotedElementStr = TclStackAlloc(interp,(unsigned) len);
+ char *quotedElementStr = TclStackAlloc(interp,
+ (unsigned) len + 1);
len = TclConvertElement(elementStr, elemLen,
quotedElementStr, flags);
diff --git a/tests/proc.test b/tests/proc.test
index c28e881..ed3c4b6 100644
--- a/tests/proc.test
+++ b/tests/proc.test
@@ -187,6 +187,11 @@ test proc-3.6 {TclObjInterpProc, proper quoting of proc name, Bug 942757} -body
{a b c}
} -returnCodes error -result {wrong # args: should be "{a b c} x"}
+test proc-3.7 {TclObjInterpProc, wrong num args, Bug 3366265} {
+ proc {} {x} {}
+ list [catch {{}} msg] $msg
+} {1 {wrong # args: should be "{} x"}}
+
catch {namespace delete {*}[namespace children :: test_ns_*]}
catch {rename p ""}
catch {rename {} ""}