mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2026-05-08 22:58:12 +02: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
|
static inline int
|
||||||
queue_peek(struct libevdev *dev, size_t idx, struct input_event *ev)
|
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;
|
return 1;
|
||||||
*ev = dev->queue[idx];
|
*ev = dev->queue[idx];
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue