mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-25 03:30:06 +01:00
Don't crash peeking at a zero-sized queue
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
7bb8e339ca
commit
70c17eac01
1 changed files with 1 additions and 1 deletions
|
|
@ -121,7 +121,7 @@ queue_pop(struct libevdev *dev, struct input_event *ev)
|
|||
static inline int
|
||||
queue_peek(struct libevdev *dev, size_t idx, struct input_event *ev)
|
||||
{
|
||||
if (idx > dev->queue_next)
|
||||
if (dev->queue_next == 0 || idx > dev->queue_next)
|
||||
return 1;
|
||||
*ev = dev->queue[idx];
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue