summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <jan.nijtmans@noemail.net>2016-08-31 08:50:23 (GMT)
committerjan.nijtmans <jan.nijtmans@noemail.net>2016-08-31 08:50:23 (GMT)
commitc2db086903143562c2a18a62984386daa9c0c3fe (patch)
treedcdd00c2d8212b54cc23ac582b5240235882f34d /generic
parenta53635d94c07e610f71185c32320786fddb6b9f8 (diff)
downloadtk-c2db086903143562c2a18a62984386daa9c0c3fe.zip
tk-c2db086903143562c2a18a62984386daa9c0c3fe.tar.gz
tk-c2db086903143562c2a18a62984386daa9c0c3fe.tar.bz2
Fix use of XMaxTransChars in stead of TCL_UTF_MAX in some places. This should prevent possible buffer overflow when TCL_UTF_MAX=6
Micro-optimizations in tkEntry and ttkEntry FossilOrigin-Name: d588631887f20ad7fabf33a3e1bd57271e6c1cf3
Diffstat (limited to 'generic')
-rw-r--r--generic/tkEntry.c3
-rw-r--r--generic/ttk/ttkEntry.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index ea8d7f1..c0ce47b 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -1943,7 +1943,8 @@ EntryComputeGeometry(
entryPtr->displayString = p;
for (i = entryPtr->numChars; --i >= 0; ) {
- p += Tcl_UniCharToUtf(ch, p);
+ memcpy(p, buf, size);
+ p += size;
}
*p = '\0';
}
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index f395649..533637d 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -290,7 +290,8 @@ static char *EntryDisplayString(const char *showChar, int numChars)
p = displayString = ckalloc(numChars * size + 1);
while (numChars--) {
- p += Tcl_UniCharToUtf(ch, p);
+ memcpy(p, buf, size);
+ p += size;
}
*p = '\0';