advpack: fix off-by-one error in AdvInstallFileW that caused buffer overrun.

This commit is contained in:
Dan Kegel 2009-11-26 21:46:51 -08:00 committed by Alexandre Julliard
parent 353339154a
commit ced19b425a
1 changed files with 2 additions and 2 deletions

View File

@ -279,13 +279,13 @@ HRESULT WINAPI AdvInstallFileW(HWND hwnd, LPCWSTR lpszSourceDir, LPCWSTR lpszSou
if (lpszDestFile)
{
dwLen = lstrlenW(lpszDestFile);
szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
szDestFilename = HeapAlloc(GetProcessHeap(), 0, (dwLen+1) * sizeof(WCHAR));
lstrcpyW(szDestFilename, lpszDestFile);
}
else
{
dwLen = lstrlenW(lpszSourceFile);
szDestFilename = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
szDestFilename = HeapAlloc(GetProcessHeap(), 0, (dwLen+1) * sizeof(WCHAR));
lstrcpyW(szDestFilename, lpszSourceFile);
}