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 | e06ad27aa954e1d75f2ec38a9d6289e82b1ce974 (patch) | |
tree | f9870888e5ec345c98637e22b52b0f4601edfa42 /win | |
parent | 85b247ce0e1cac7287bb8db6a2a04ca78d6dfcf6 (diff) | |
download | tcl-e06ad27aa954e1d75f2ec38a9d6289e82b1ce974.zip tcl-e06ad27aa954e1d75f2ec38a9d6289e82b1ce974.tar.gz tcl-e06ad27aa954e1d75f2ec38a9d6289e82b1ce974.tar.bz2 |
[Bug 3362446]: possible allocation error when using UNICODE
Diffstat (limited to 'win')
-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); |