mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-12 18:39:45 +00:00
Fix #1007: strcpy requires the number of chars not bytes
This commit is contained in:
@@ -103,7 +103,7 @@ void DOpus::ParseXmlBuffer(PWCHAR buffer)
|
|||||||
auto b = new WCHAR[size];
|
auto b = new WCHAR[size];
|
||||||
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, path, -1, b, size);
|
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, path, -1, b, size);
|
||||||
|
|
||||||
wcscpy_s(buffer, MAX_PATH_EX, b); // DOpus supports Long Path
|
wcscpy_s(buffer, wcslen(b) + 1, b); // DOpus supports Long Path
|
||||||
|
|
||||||
delete[] b;
|
delete[] b;
|
||||||
return; // we now cares only the first result
|
return; // we now cares only the first result
|
||||||
|
@@ -90,14 +90,14 @@ void GetCurrentSelection()
|
|||||||
if (hMapFile == nullptr)
|
if (hMapFile == nullptr)
|
||||||
return;
|
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)
|
if (buffer == nullptr)
|
||||||
{
|
{
|
||||||
CloseHandle(hMapFile);
|
CloseHandle(hMapFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscpy_s(buffer, MAX_PATH_EX, dllBuffer);
|
wcscpy_s(buffer, wcslen(dllBuffer) + 1, dllBuffer);
|
||||||
|
|
||||||
UnmapViewOfFile(buffer);
|
UnmapViewOfFile(buffer);
|
||||||
CloseHandle(hMapFile);
|
CloseHandle(hMapFile);
|
||||||
|
Reference in New Issue
Block a user