[SETUPAPI]

- fix confusion on buffer size between string length and number of bytes.
Might fix some infamous heap corruption bug during install. Please test.

svn path=/trunk/; revision=53160
This commit is contained in:
Jérôme Gardou 2011-08-10 01:31:35 +00:00
parent 73386b2c5c
commit 5a88d3050f

View file

@ -681,9 +681,9 @@ RegGetValueW( HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue,
if (dwType == REG_EXPAND_SZ)
{
cbData = ExpandEnvironmentStringsW(pvBuf, pvData,
pcbData ? *pcbData : 0);
pcbData ? (*pcbData)/sizeof(WCHAR) : 0);
dwType = REG_SZ;
if(pcbData && cbData > *pcbData)
if(pcbData && cbData > ((*pcbData)/sizeof(WCHAR)))
ret = ERROR_MORE_DATA;
}
else if (pcbData)
@ -814,7 +814,7 @@ SetupDiBuildDriverInfoList(
KEY_QUERY_VALUE);
if (hDriverKey == INVALID_HANDLE_VALUE)
goto done;
RequiredSize = len - strlenW(InfFileName);
RequiredSize = (len - strlenW(InfFileName)) * sizeof(WCHAR);
rc = RegGetValueW(
hDriverKey,
NULL,