summaryrefslogtreecommitdiffstats
path: root/generic/ttk
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)
commit3710a862b304ce13a5d771616b45eaa556f201bc (patch)
treeb89107a81aaee65f22938a9b9f99531a9877eefd /generic/ttk
parentb237ee23c355f68d92dccd811aa8bfd6f1ceed05 (diff)
parent34d8945d9d1dbbb3f599cabcad75ec0305f7615d (diff)
downloadtk-3710a862b304ce13a5d771616b45eaa556f201bc.zip
tk-3710a862b304ce13a5d771616b45eaa556f201bc.tar.gz
tk-3710a862b304ce13a5d771616b45eaa556f201bc.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/ttk')
-rw-r--r--generic/ttk/ttkEntry.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index f395649..d80e1fd 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -283,14 +283,15 @@ static char *EntryDisplayString(const char *showChar, int numChars)
char *displayString, *p;
int size;
Tcl_UniChar ch;
- char buf[TCL_UTF_MAX];
+ char buf[4];
Tcl_UtfToUniChar(showChar, &ch);
size = Tcl_UniCharToUtf(ch, buf);
p = displayString = ckalloc(numChars * size + 1);
while (numChars--) {
- p += Tcl_UniCharToUtf(ch, p);
+ memcpy(p, buf, size);
+ p += size;
}
*p = '\0';