Allocate the correct size string in InternetCrackUrl.

This commit is contained in:
Mike McCormack 2004-07-04 00:06:44 +00:00 committed by Alexandre Julliard
parent cef19de855
commit 1510cfc474
1 changed files with 7 additions and 5 deletions

View File

@ -1024,11 +1024,13 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
DWORD nLength;
URL_COMPONENTSW UCW;
WCHAR* lpwszUrl;
if(dwUrlLength==0)
dwUrlLength=strlen(lpszUrl);
lpwszUrl=HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(dwUrlLength+1));
memset(lpwszUrl,0,sizeof(WCHAR)*(dwUrlLength+1));
nLength=MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,dwUrlLength+1);
if(dwUrlLength<=0)
dwUrlLength=-1;
nLength=MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,NULL,0);
lpwszUrl=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WCHAR)*nLength);
MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,nLength);
memset(&UCW,0,sizeof(UCW));
if(lpUrlComponents->dwHostNameLength!=0)
UCW.dwHostNameLength=1;