Skip to content

Commit 6b88515

Browse files
committed
Fix ioctl() requested buffer size - it should be specified in bytes not bits.
This commit is part of Jakub Klama's work on bringing evdev support into the FreeBSD kernel. Author: Jakub Wojciech Klama <jceel@freebsd.org>
1 parent 5e06023 commit 6b88515

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎evdev/input.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ ioctl_capabilities(PyObject *self, PyObject *args)
164164

165165
memset(&ev_bits, 0, sizeof(ev_bits));
166166

167-
if (ioctl(_fd, EVIOCGBIT(0, EV_MAX), ev_bits) < 0)
167+
if (ioctl(_fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits) < 0)
168168
goto on_err;
169169

170170
// Build a dictionary of the device's capabilities
@@ -175,7 +175,7 @@ ioctl_capabilities(PyObject *self, PyObject *args)
175175
eventcodes = PyList_New(0);
176176

177177
memset(&code_bits, 0, sizeof(code_bits));
178-
ioctl(_fd, EVIOCGBIT(ev_type, KEY_MAX), code_bits);
178+
ioctl(_fd, EVIOCGBIT(ev_type, sizeof(code_bits)), code_bits);
179179

180180
for (ev_code = 0; ev_code < KEY_MAX; ev_code++) {
181181
if (test_bit(code_bits, ev_code)) {

0 commit comments

Comments
 (0)