summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-02-09 15:00:46 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-02-09 15:00:46 (GMT)
commitdf15da28485c15bf11e1412ac5375e51f15b7ca6 (patch)
tree62b0ddf0cdb20a546d439a7a60a4f5853f9c8871 /generic/tclStringObj.c
parent1470e2393e11850bf0746c28fe285f966af7a735 (diff)
parente808998f32299b76b5d72c1eeab0c61d7b39912e (diff)
downloadtcl-df15da28485c15bf11e1412ac5375e51f15b7ca6.zip
tcl-df15da28485c15bf11e1412ac5375e51f15b7ca6.tar.gz
tcl-df15da28485c15bf11e1412ac5375e51f15b7ca6.tar.bz2
3484402 Correct Off-By-One error appending unicode. Thanks to Poor Yorick.
Also corrected test for when growth is needed.
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 13dda54..3f243a6 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1379,7 +1379,7 @@ AppendUnicodeToUnicodeRep(
numChars = stringPtr->numChars + appendNumChars;
stringCheckLimits(numChars);
- if (STRING_UALLOC(numChars) >= stringPtr->uallocated) {
+ if (STRING_UALLOC(numChars) > stringPtr->uallocated) {
/*
* Protect against case where unicode points into the existing
* stringPtr->unicode array. Force it to follow any relocations
@@ -1387,7 +1387,7 @@ AppendUnicodeToUnicodeRep(
*/
int offset = -1;
if (unicode >= stringPtr->unicode && unicode <= stringPtr->unicode
- + 1 + stringPtr->uallocated / sizeof(Tcl_UniChar)) {
+ + stringPtr->uallocated / sizeof(Tcl_UniChar)) {
offset = unicode - stringPtr->unicode;
}