summaryrefslogtreecommitdiffstats
path: root/generic/tkEntry.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-08-31 08:55:32 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-08-31 08:55:32 (GMT)
commit424428fd6bc5205a89e05a7c3ce3ae1abb58e9f7 (patch)
treeb89107a81aaee65f22938a9b9f99531a9877eefd /generic/tkEntry.c
parent3b59770739821e36c3f5557ecfaae082b66f4322 (diff)
parentea6b35b21034a7ccfb568ab20f1c850b5619b8a7 (diff)
downloadtk-424428fd6bc5205a89e05a7c3ce3ae1abb58e9f7.zip
tk-424428fd6bc5205a89e05a7c3ce3ae1abb58e9f7.tar.gz
tk-424428fd6bc5205a89e05a7c3ce3ae1abb58e9f7.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
Diffstat (limited to 'generic/tkEntry.c')
-rw-r--r--generic/tkEntry.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 5681e47..a66cf18 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -1927,7 +1927,7 @@ EntryComputeGeometry(
if (entryPtr->showChar != NULL) {
Tcl_UniChar ch;
- char buf[TCL_UTF_MAX];
+ char buf[4];
int size;
/*
@@ -1945,7 +1945,8 @@ EntryComputeGeometry(
entryPtr->displayString = p;
for (i = entryPtr->numChars; --i >= 0; ) {
- p += Tcl_UniCharToUtf(ch, p);
+ memcpy(p, buf, size);
+ p += size;
}
*p = '\0';
}