mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-02 05:15:01 +00:00
wininet: Avoid accessing uninitialized memory in ConvertUrlComponentValue.
Found by valgrind.
This commit is contained in:
parent
c3775d82d3
commit
b707a523e3
1 changed files with 6 additions and 3 deletions
|
@ -1133,11 +1133,14 @@ static void ConvertUrlComponentValue(LPSTR* lppszComponent, LPDWORD dwComponentL
|
|||
DWORD nASCIILength=WideCharToMultiByte(CP_ACP,0,lpwszComponent,dwwComponentLen,NULL,0,NULL,NULL);
|
||||
if (*lppszComponent == NULL)
|
||||
{
|
||||
int nASCIIOffset=WideCharToMultiByte(CP_ACP,0,lpwszStart,lpwszComponent-lpwszStart,NULL,0,NULL,NULL);
|
||||
if (lpwszComponent)
|
||||
*lppszComponent = (LPSTR)lpszStart+nASCIIOffset;
|
||||
{
|
||||
int offset = WideCharToMultiByte(CP_ACP, 0, lpwszStart, lpwszComponent-lpwszStart, NULL, 0, NULL, NULL);
|
||||
*lppszComponent = (LPSTR)lpszStart + offset;
|
||||
}
|
||||
else
|
||||
*lppszComponent = NULL;
|
||||
|
||||
*dwComponentLen = nASCIILength;
|
||||
}
|
||||
else
|
||||
|
@ -1184,7 +1187,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
|
|||
InternetCrackUrlW should not include it */
|
||||
if (dwUrlLength == -1) nLength--;
|
||||
|
||||
lpwszUrl=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WCHAR)*nLength);
|
||||
lpwszUrl = HeapAlloc(GetProcessHeap(), 0, nLength * sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,nLength);
|
||||
|
||||
memset(&UCW,0,sizeof(UCW));
|
||||
|
|
Loading…
Reference in a new issue