Fix #1007: strcpy requires the number of chars not bytes

This commit is contained in:
Paddy Xu
2021-10-18 21:22:24 +02:00
parent fe6dae67ce
commit e640a8b98a
2 changed files with 3 additions and 3 deletions

View File

@@ -90,14 +90,14 @@ void GetCurrentSelection()
if (hMapFile == nullptr)
return;
auto buffer = static_cast<PWCHAR>(MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, MAX_PATH * sizeof WCHAR));
auto buffer = static_cast<PWCHAR>(MapViewOfFile(hMapFile, FILE_MAP_WRITE, 0, 0, 0));
if (buffer == nullptr)
{
CloseHandle(hMapFile);
return;
}
wcscpy_s(buffer, MAX_PATH_EX, dllBuffer);
wcscpy_s(buffer, wcslen(dllBuffer) + 1, dllBuffer);
UnmapViewOfFile(buffer);
CloseHandle(hMapFile);