summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-08-01 20:58:14 (GMT)
committerJulien Cristau <jcristau@debian.org>2008-08-01 20:58:14 (GMT)
commit89b1add387b52ef55f5a8f87603153d27207e2f6 (patch)
tree78ddd7e50df007716159e384770ababcdbd06488
parentc0096b2e3992853745edf02243b1da885ace4d03 (diff)
Fix crash on kernels with extended keymap space
The len argument of EVIOCGBIT(ev,len) is the size of the receiving buffer in bytes, not maximim number of bits to retrieve. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--src/eventcomm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c
index 36c4c9e..e654102 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -79,7 +79,7 @@ event_query_is_touchpad(int fd)
/* Check for ABS_X, ABS_Y, ABS_PRESSURE and BTN_TOOL_FINGER */
- SYSCALL(ret = ioctl(fd, EVIOCGBIT(0, EV_MAX), evbits));
+ SYSCALL(ret = ioctl(fd, EVIOCGBIT(0, sizeof(evbits)), evbits));
if (ret < 0)
return FALSE;
if (!TEST_BIT(EV_SYN, evbits) ||
@@ -87,7 +87,7 @@ event_query_is_touchpad(int fd)
!TEST_BIT(EV_KEY, evbits))
return FALSE;
- SYSCALL(ret = ioctl(fd, EVIOCGBIT(EV_ABS, KEY_MAX), evbits));
+ SYSCALL(ret = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(evbits)), evbits));
if (ret < 0)
return FALSE;
if (!TEST_BIT(ABS_X, evbits) ||
@@ -95,7 +95,7 @@ event_query_is_touchpad(int fd)
!TEST_BIT(ABS_PRESSURE, evbits))
return FALSE;
- SYSCALL(ret = ioctl(fd, EVIOCGBIT(EV_KEY, KEY_MAX), evbits));
+ SYSCALL(ret = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(evbits)), evbits));
if (ret < 0)
return FALSE;
if (!TEST_BIT(BTN_TOOL_FINGER, evbits))