dinput: Ensure buffer doesn't overflow (Coverity).

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2019-06-16 06:50:02 +00:00 committed by Alexandre Julliard
parent c2a8f3d8a0
commit 55edfc8837
2 changed files with 3 additions and 3 deletions

View File

@ -700,7 +700,7 @@ HRESULT WINAPI JoystickAGenericImpl_GetDeviceInfo(
/* we only support traditional joysticks for now */
pdidi->dwDevType = This->devcaps.dwDevType;
snprintf(pdidi->tszInstanceName, MAX_PATH, "Joystick %d", index);
strcpy(pdidi->tszProductName, This->name);
lstrcpynA(pdidi->tszProductName, This->name, MAX_PATH);
if (pdidi->dwSize > sizeof(DIDEVICEINSTANCE_DX3A)) {
pdidi->guidFFDriver = GUID_NULL;
pdidi->wUsagePage = 0;

View File

@ -411,8 +411,8 @@ static void fill_joystick_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD ver
lpddi->guidInstance = lpddiW.guidInstance;
lpddi->guidProduct = lpddiW.guidProduct;
lpddi->dwDevType = lpddiW.dwDevType;
strcpy(lpddi->tszInstanceName, joydevs[id].name);
strcpy(lpddi->tszProductName, joydevs[id].name);
lstrcpynA(lpddi->tszInstanceName, joydevs[id].name, MAX_PATH);
lstrcpynA(lpddi->tszProductName, joydevs[id].name, MAX_PATH);
lpddi->guidFFDriver = lpddiW.guidFFDriver;
lpddi->wUsagePage = lpddiW.wUsagePage;
lpddi->wUsage = lpddiW.wUsage;