diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2023-04-27 12:47:08 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2023-04-27 12:47:08 (GMT) |
commit | 18f61eeeeb444689bb9871ce53c8187e7bc3133a (patch) | |
tree | 8027a8be65cf65dbf63921e51113b8fcca7590c5 /generic/tclUtil.c | |
parent | 5ddcd8fea990af78cce1ef7d706e0a0ce81a317b (diff) | |
download | tcl-18f61eeeeb444689bb9871ce53c8187e7bc3133a.zip tcl-18f61eeeeb444689bb9871ce53c8187e7bc3133a.tar.gz tcl-18f61eeeeb444689bb9871ce53c8187e7bc3133a.tar.bz2 |
More checks for exceeding max words
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r-- | generic/tclUtil.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index b765a0f..07b497b 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3977,6 +3977,46 @@ TclIndexInvalidError ( } /* + *------------------------------------------------------------------------ + * + * TclCommandWordLimitErrpr -- + * + * Generates an error message limit on number of command words exceeded. + * + * Results: + * Always return TCL_ERROR. + * + * Side effects: + * If interp is not-NULL, an error message is stored in it. + * + *------------------------------------------------------------------------ + */ +int +TclCommandWordLimitError ( + Tcl_Interp *interp, /* May be NULL */ + Tcl_Size count) /* If <= 0, "unknown" */ +{ + if (interp) { + if (count > 0) { + Tcl_SetObjResult( + interp, + Tcl_ObjPrintf("Number of words (%" TCL_SIZE_MODIFIER + "d) in command exceeds limit %" TCL_SIZE_MODIFIER + "d.", + count, + (Tcl_Size)INT_MAX)); + } + else { + Tcl_SetObjResult(interp, + Tcl_ObjPrintf("Number of words in command exceeds " + "limit %" TCL_SIZE_MODIFIER "d.", + (Tcl_Size)INT_MAX)); + } + } + return TCL_ERROR; /* Always */ +} + +/* *---------------------------------------------------------------------- * * ClearHash -- |