summaryrefslogtreecommitdiffstats
path: root/win/tkWinX.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-08-31 08:50:23 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-08-31 08:50:23 (GMT)
commit34d8945d9d1dbbb3f599cabcad75ec0305f7615d (patch)
treedcdd00c2d8212b54cc23ac582b5240235882f34d /win/tkWinX.c
parentbdab09a0d9b8ae500789e11038ce4a96802388ec (diff)
downloadtk-34d8945d9d1dbbb3f599cabcad75ec0305f7615d.zip
tk-34d8945d9d1dbbb3f599cabcad75ec0305f7615d.tar.gz
tk-34d8945d9d1dbbb3f599cabcad75ec0305f7615d.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 'win/tkWinX.c')
-rw-r--r--win/tkWinX.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 6c44059..99102cb 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -1215,13 +1215,13 @@ GenerateXEvent(
break;
case WM_UNICHAR: {
- char buffer[TCL_UTF_MAX+1];
+ char buffer[XMaxTransChars];
int i;
event.type = KeyPress;
event.xany.send_event = -3;
event.xkey.keycode = wParam;
event.xkey.nbytes = Tcl_UniCharToUtf((int)wParam, buffer);
- for (i=0; i<event.xkey.nbytes && i<TCL_UTF_MAX; ++i) {
+ for (i=0; i<event.xkey.nbytes && i<XMaxTransChars; ++i) {
event.xkey.trans_chars[i] = buffer[i];
}
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);