summaryrefslogtreecommitdiffstats
path: root/generic/tclEncoding.c
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-02-27 12:31:49 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-02-27 12:31:49 (GMT)
commit85bf0db1e84ab483fce7962c151bedeb3f5e0993 (patch)
tree131eba768a91531d940a0f3c4f3f88571bc70ca0 /generic/tclEncoding.c
parente2d89615d52e47ed3b683498567e058e809aea39 (diff)
downloadtcl-85bf0db1e84ab483fce7962c151bedeb3f5e0993.zip
tcl-85bf0db1e84ab483fce7962c151bedeb3f5e0993.tar.gz
tcl-85bf0db1e84ab483fce7962c151bedeb3f5e0993.tar.bz2
Fix crash. int->size_t needs +1 in comparisons.
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r--generic/tclEncoding.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index a6ecc26..d0756c7 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -1473,7 +1473,7 @@ Tcl_UtfToExternalDStringEx(
!(result == TCL_CONVERT_MULTIBYTE && (flags & TCL_ENCODING_END))) {
size_t i = soFar + encodingPtr->nullSize - 1;
/* Loop as DStringSetLength only stores one nul byte at a time */
- while (i >= soFar) {
+ while (i+1 >= soFar+1) {
Tcl_DStringSetLength(dstPtr, i--);
}
return (result == TCL_OK) ? TCL_INDEX_NONE : (Tcl_Size)(src - srcStart);