summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r--generic/tclObj.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 03dec9e..29c200f 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -1675,7 +1675,11 @@ TclGetStringFromObj(
}
}
if (lengthPtr != NULL) {
- *lengthPtr = (objPtr->length < INT_MAX)? objPtr->length: INT_MAX;
+ if (objPtr->length > INT_MAX) {
+ Tcl_Panic("Tcl_GetStringFromObj with 'int' lengthPtr"
+ "cannot handle such long strings. Please use 'size_t'");
+ }
+ *lengthPtr = (int)objPtr->length;
}
return objPtr->bytes;
}