quartz: Ensure error text is terminated with NUL character.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2019-05-30 22:58:09 +09:00 committed by Alexandre Julliard
parent 7b8554b3b8
commit fc4ef8692e
1 changed files with 7 additions and 1 deletions

View File

@ -313,7 +313,13 @@ DWORD WINAPI AMGetErrorTextA(HRESULT hr, LPSTR buffer, DWORD maxlen)
return 0;
res = AMGetErrorTextW(hr, errorW, ARRAY_SIZE(errorW));
return WideCharToMultiByte(CP_ACP, 0, errorW, res, buffer, maxlen, 0, 0);
if (!res)
return 0;
res = WideCharToMultiByte(CP_ACP, 0, errorW, -1, NULL, 0, 0, 0);
if (res > maxlen || !res)
return 0;
return WideCharToMultiByte(CP_ACP, 0, errorW, -1, buffer, maxlen, 0, 0) - 1;
}
/***********************************************************************