[PATCH] dinput: GetKeyNameW takes chars not bytes (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat May 11 12:27:27 CDT 2013


 713163 Out-of-bounds access
---
 dlls/dinput/keyboard.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index 8e1d1a4..99697a1 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -439,7 +439,7 @@ static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface
     scan = DIDFT_GETINSTANCE(pdidoi->dwType);
     if (scan == DIK_PAUSE || scan == DIK_NUMLOCK) scan ^= 0x80;
     if (!GetKeyNameTextW((scan & 0x80) << 17 | (scan & 0x7f) << 16,
-                         pdidoi->tszName, sizeof(pdidoi->tszName)))
+                         pdidoi->tszName, sizeof(pdidoi->tszName)/sizeof(pdidoi->tszName[0])))
         return DIERR_OBJECTNOTFOUND;
 
     _dump_OBJECTINSTANCEW(pdidoi);
-- 
1.7.10.4




More information about the wine-patches mailing list