summaryrefslogtreecommitdiffstats
path: root/generic/tclIndexObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclIndexObj.c')
-rw-r--r--generic/tclIndexObj.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index 8a630d7..442aae2 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -1026,7 +1026,7 @@ Tcl_ParseArgsObjv(
}
/*
- * Loop throught the argument descriptors searching for one with the
+ * Loop through the argument descriptors searching for one with the
* matching key string. If found, leave a pointer to it in matchPtr.
*/
@@ -1142,14 +1142,22 @@ Tcl_ParseArgsObjv(
break;
}
case TCL_ARGV_GENFUNC: {
+ int i = (int)objc;
+
+ if (objc > INT_MAX) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "too many (%" TCL_Z_MODIFIER "u) arguments for TCL_ARGV_GENFUNC", objc));
+ goto error;
+ }
Tcl_ArgvGenFuncProc *handlerProc = (Tcl_ArgvGenFuncProc *)
infoPtr->srcPtr;
- objc = handlerProc(infoPtr->clientData, interp, objc,
+ i = handlerProc(infoPtr->clientData, interp, i,
&objv[srcIndex], infoPtr->dstPtr);
- if ((int)objc < 0) {
+ if (i < 0) {
goto error;
}
+ objc = i;
break;
}
case TCL_ARGV_HELP: