summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-06-21 10:56:52 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-06-21 10:56:52 (GMT)
commit989a8101fcd98ea1768732253c10b554aa99f9be (patch)
treea0152697b695bc4cf5f54cd4e7e05f0cb67ac846
parent0b65aa03a149454b15064d63aa2043fe094d3016 (diff)
downloadtcl-989a8101fcd98ea1768732253c10b554aa99f9be.zip
tcl-989a8101fcd98ea1768732253c10b554aa99f9be.tar.gz
tcl-989a8101fcd98ea1768732253c10b554aa99f9be.tar.bz2
[Bug 3362446]: possible allocation error when using UNICODE
-rw-r--r--win/tclWinReg.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index de9f756..ee0c243 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.c
@@ -17,7 +17,6 @@
# define USE_TCL_STUBS
#endif
#include "tclInt.h"
-#include "tclPort.h"
#ifdef _MSC_VER
# pragma comment (lib, "advapi32.lib")
#endif
@@ -766,8 +765,8 @@ GetValue(
*/
Tcl_DStringInit(&data);
- length = TCL_DSTRING_STATIC_SIZE - 1;
- Tcl_DStringSetLength(&data, (int) length);
+ Tcl_DStringSetLength(&data, (int) TCL_DSTRING_STATIC_SIZE - 1);
+ length = TCL_DSTRING_STATIC_SIZE/sizeof(TCHAR) - 1;
valueName = Tcl_GetStringFromObj(valueNameObj, &nameLen);
nativeValue = Tcl_WinUtfToTChar(valueName, nameLen, &buf);
@@ -910,7 +909,7 @@ GetValueNames(
size = MAX_KEY_LENGTH;
while (RegEnumValue(key,index, (TCHAR *)Tcl_DStringValue(&buffer),
&size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
- size *= 2;
+ size *= sizeof(TCHAR);
Tcl_WinTCharToUtf((TCHAR *) Tcl_DStringValue(&buffer), (int) size,
&ds);