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

View File

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