summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2023-11-30 15:05:51 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2024-01-18 00:07:04 +0000
commitae3eca18cec44a953789c7f77ffab888713ed132 (patch)
tree8f54c5df92b13bc16d8ff9e0230a5ec431d5488f
parent0a951047f64e87c5ab328084310bf27bcd4964f3 (diff)
Fix _XkbReadGetDeviceInfoReply for nButtons == dev->buttons
XkbGetDeviceInfo(dpy, XkbXI_ButtonActionsMask, 2, 0, 0) always returns NULL because the number of buttons on the device equals (unsurpisingly) the number of buttons requested (i.e. first + nBtns == dev->nbuttons). This currently causes it to bail out and return NULL. Fixes f293659d5a4024bda386305bb7ebeb4647c40934
-rw-r--r--src/xkb/XKBExtDev.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/xkb/XKBExtDev.c b/src/xkb/XKBExtDev.c
index a3e671df..162cc356 100644
--- a/src/xkb/XKBExtDev.c
+++ b/src/xkb/XKBExtDev.c
@@ -188,8 +188,7 @@ _XkbReadGetDeviceInfoReply(Display *dpy,
return tmp;
}
if (rep->nBtnsWanted > 0) {
- if (((unsigned short) rep->firstBtnWanted + rep->nBtnsWanted)
- >= devi->num_btns)
+ if (((unsigned short) rep->firstBtnWanted + rep->nBtnsWanted) > devi->num_btns)
goto BAILOUT;
act = &devi->btn_acts[rep->firstBtnWanted];
bzero((char *) act, (rep->nBtnsWanted * sizeof(XkbAction)));
@@ -201,8 +200,7 @@ _XkbReadGetDeviceInfoReply(Display *dpy,
if (rep->nBtnsRtrn > 0) {
int size;
- if (((unsigned short) rep->firstBtnRtrn + rep->nBtnsRtrn)
- >= devi->num_btns)
+ if (((unsigned short) rep->firstBtnRtrn + rep->nBtnsRtrn) > devi->num_btns)
goto BAILOUT;
act = &devi->btn_acts[rep->firstBtnRtrn];
size = rep->nBtnsRtrn * SIZEOF(xkbActionWireDesc);