advpack: fix off-by-one error in AdvInstallFileW that caused buffer overrun.
This commit is contained in:
parent
353339154a
commit
ced19b425a
|
@ -279,13 +279,13 @@ HRESULT WINAPI AdvInstallFileW(HWND hwnd, LPCWSTR lpszSourceDir, LPCWSTR lpszSou
|
||||||
if (lpszDestFile)
|
if (lpszDestFile)
|
||||||
{
|
{
|
||||||
dwLen = lstrlenW(lpszDestFile);
|
dwLen = lstrlenW(lpszDestFile);
|
||||||
szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
|
szDestFilename = HeapAlloc(GetProcessHeap(), 0, (dwLen+1) * sizeof(WCHAR));
|
||||||
lstrcpyW(szDestFilename, lpszDestFile);
|
lstrcpyW(szDestFilename, lpszDestFile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dwLen = lstrlenW(lpszSourceFile);
|
dwLen = lstrlenW(lpszSourceFile);
|
||||||
szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
|
szDestFilename = HeapAlloc(GetProcessHeap(), 0, (dwLen+1) * sizeof(WCHAR));
|
||||||
lstrcpyW(szDestFilename, lpszSourceFile);
|
lstrcpyW(szDestFilename, lpszSourceFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue