wininet: Fix some string length calculations.
Fix some string length calculations that didn't account for the different sized characters with Unicode.
This commit is contained in:
parent
4f40f17226
commit
c564ee826f
|
@ -943,8 +943,8 @@ static BOOL URLCache_CopyEntry(
|
||||||
lenUrl = MultiByteToWideChar(CP_ACP, 0, (LPSTR)pUrlEntry + pUrlEntry->dwOffsetUrl, -1, NULL, 0);
|
lenUrl = MultiByteToWideChar(CP_ACP, 0, (LPSTR)pUrlEntry + pUrlEntry->dwOffsetUrl, -1, NULL, 0);
|
||||||
else
|
else
|
||||||
lenUrl = strlen((LPSTR)pUrlEntry + pUrlEntry->dwOffsetUrl);
|
lenUrl = strlen((LPSTR)pUrlEntry + pUrlEntry->dwOffsetUrl);
|
||||||
dwRequiredSize += lenUrl + 1;
|
dwRequiredSize += (lenUrl + 1) * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
|
||||||
|
|
||||||
/* FIXME: is source url optional? */
|
/* FIXME: is source url optional? */
|
||||||
if (*lpdwBufferSize >= dwRequiredSize)
|
if (*lpdwBufferSize >= dwRequiredSize)
|
||||||
{
|
{
|
||||||
|
@ -970,7 +970,7 @@ static BOOL URLCache_CopyEntry(
|
||||||
{
|
{
|
||||||
lpCacheEntryInfo->lpszLocalFileName = lpszLocalFileName;
|
lpCacheEntryInfo->lpszLocalFileName = lpszLocalFileName;
|
||||||
}
|
}
|
||||||
dwRequiredSize += nLocalFilePathSize;
|
dwRequiredSize += nLocalFilePathSize * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)) ;
|
||||||
|
|
||||||
if ((dwRequiredSize % 4) && (dwRequiredSize < *lpdwBufferSize))
|
if ((dwRequiredSize % 4) && (dwRequiredSize < *lpdwBufferSize))
|
||||||
ZeroMemory((LPBYTE)lpCacheEntryInfo + dwRequiredSize, 4 - (dwRequiredSize % 4));
|
ZeroMemory((LPBYTE)lpCacheEntryInfo + dwRequiredSize, 4 - (dwRequiredSize % 4));
|
||||||
|
|
Loading…
Reference in New Issue