mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-05 14:50:15 +01:00
tools: libinput-record: put extra guard in to protect from OOB access
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
8865d4a29d
commit
b4ff592a5a
1 changed files with 4 additions and 1 deletions
|
|
@ -716,6 +716,7 @@ buffer_gesture_event(struct record_context *ctx,
|
|||
static char *
|
||||
buffer_tablet_axes(struct libinput_event_tablet_tool *t)
|
||||
{
|
||||
const int MAX_AXES = 10;
|
||||
struct libinput_tablet_tool *tool;
|
||||
char *s = NULL;
|
||||
int idx = 0;
|
||||
|
|
@ -725,7 +726,7 @@ buffer_tablet_axes(struct libinput_event_tablet_tool *t)
|
|||
|
||||
tool = libinput_event_tablet_tool_get_tool(t);
|
||||
|
||||
strv = zalloc(10 * sizeof *strv);
|
||||
strv = zalloc(MAX_AXES * sizeof *strv);
|
||||
|
||||
x = libinput_event_tablet_tool_get_x(t);
|
||||
y = libinput_event_tablet_tool_get_y(t);
|
||||
|
|
@ -789,6 +790,8 @@ buffer_tablet_axes(struct libinput_event_tablet_tool *t)
|
|||
goto out;
|
||||
}
|
||||
|
||||
assert(idx < MAX_AXES);
|
||||
|
||||
s = strv_join(strv, ", ");
|
||||
out:
|
||||
strv_free(strv);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue