diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-06-21 10:59:15 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-06-21 10:59:15 (GMT) |
commit | b6f50b1321a5cd34af747eb670aad924fc66d7b7 (patch) | |
tree | f9870888e5ec345c98637e22b52b0f4601edfa42 | |
parent | 38f0b4d80988173806607621adbf9258d555f033 (diff) | |
download | tcl-b6f50b1321a5cd34af747eb670aad924fc66d7b7.zip tcl-b6f50b1321a5cd34af747eb670aad924fc66d7b7.tar.gz tcl-b6f50b1321a5cd34af747eb670aad924fc66d7b7.tar.bz2 |
[Bug 3362446]: possible allocation error when using UNICODE
-rw-r--r-- | win/tclWinReg.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/win/tclWinReg.c b/win/tclWinReg.c index 7d50996..701edfb 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -731,8 +731,8 @@ GetValue( */ Tcl_DStringInit(&data); - length = TCL_DSTRING_STATIC_SIZE - 1; - Tcl_DStringSetLength(&data, (int) length); + Tcl_DStringSetLength(&data, TCL_DSTRING_STATIC_SIZE - 1); + length = TCL_DSTRING_STATIC_SIZE / (regWinProcs->useWide ? 2 : 1) - 1; resultPtr = Tcl_GetObjResult(interp); @@ -748,8 +748,8 @@ GetValue( * Required for HKEY_PERFORMANCE_DATA */ length *= 2; - Tcl_DStringSetLength(&data, (int) length); - result = (*regWinProcs->regQueryValueExProc)(key, (char *) nativeValue, + Tcl_DStringSetLength(&data, (int) length * (regWinProcs->useWide ? 2 : 1)); + result = (*regWinProcs->regQueryValueExProc)(key, (char *) nativeValue, NULL, &type, (BYTE *) Tcl_DStringValue(&data), &length); } Tcl_DStringFree(&buf); |