Commit bec279d8 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

version: Use the string value length when converting strings.

parent efe0a09f
......@@ -1010,6 +1010,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
BOOL ret, isText;
INT len;
LPWSTR lpSubBlockW;
UINT value_len;
len = MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, NULL, 0);
lpSubBlockW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
......@@ -1019,7 +1020,8 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, lpSubBlockW, len);
ret = VersionInfo32_QueryValue(pBlock, lpSubBlockW, lplpBuffer, puLen, &isText);
ret = VersionInfo32_QueryValue(pBlock, lpSubBlockW, lplpBuffer, &value_len, &isText);
if (puLen) *puLen = value_len;
HeapFree(GetProcessHeap(), 0, lpSubBlockW);
......@@ -1030,8 +1032,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
*/
LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4;
DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, -1,
len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, value_len,
lpBufferA + pos, info->wLength - pos, NULL, NULL);
*lplpBuffer = lpBufferA + pos;
if (puLen) *puLen = len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment