summaryrefslogtreecommitdiffstats
path: root/generic/tclStubInit.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-12-28 21:15:20 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-12-28 21:15:20 (GMT)
commit4a038240c4966cfaa72e90901a3a9951f6f3d020 (patch)
tree9b778c950b64d8d17d73fe29a2e4b9f5ea8569c4 /generic/tclStubInit.c
parenta27cc004d279f6e156c70540cee7c5f68f315025 (diff)
parentad43c617e3fb81c44639a400b8a6d611aa52e3f2 (diff)
downloadtcl-4a038240c4966cfaa72e90901a3a9951f6f3d020.zip
tcl-4a038240c4966cfaa72e90901a3a9951f6f3d020.tar.gz
tcl-4a038240c4966cfaa72e90901a3a9951f6f3d020.tar.bz2
merge core-8-6-branch
Diffstat (limited to 'generic/tclStubInit.c')
-rw-r--r--generic/tclStubInit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index fe5bd9d..227bf02 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -221,6 +221,7 @@ Tcl_WinUtfToTChar(
Tcl_DStringSetLength(dsPtr, 2*size+2);
wp = (WCHAR *)Tcl_DStringValue(dsPtr);
MultiByteToWideChar(CP_UTF8, 0, string, len, wp, size+1);
+ if (len == -1) --size; /* account for 0-byte at string end */
Tcl_DStringSetLength(dsPtr, 2*size);
wp[size] = 0;
return (char *)wp;
@@ -251,6 +252,7 @@ Tcl_WinTCharToUtf(
Tcl_DStringSetLength(dsPtr, size+1);
p = (char *)Tcl_DStringValue(dsPtr);
WideCharToMultiByte(CP_UTF8, 0, string, len, p, size, NULL, NULL);
+ if (len == -1) --size; /* account for 0-byte at string end */
Tcl_DStringSetLength(dsPtr, size);
p[size] = 0;
return p;