From 55edfc8837a26ced87964014c6e62e1be7dcc5e3 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sun, 16 Jun 2019 06:50:02 +0000 Subject: [PATCH] dinput: Ensure buffer doesn't overflow (Coverity). Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Alexandre Julliard --- dlls/dinput/joystick.c | 2 +- dlls/dinput/joystick_linuxinput.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index 433348cd043..a5308b6cc48 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -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; diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index e3371b9f441..1e8c542f21d 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -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;