mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-05 12:10:28 +01:00
test: Make udev_properties array fixed-size.
The udev_properties array is currently variable length, which causes the
tests to invoke undefined behavior on empty lists, as it attempts to
access the first array item to check if the key is NULL, which is an out
of bounds read and will fail when the struct alignment happens to line
up such that there is no padding after the list in the empty list case.
By making the udev_properties array 32 items long, it can encapsulate
every existing case, with only a fairly small amount of memory overhead,
and without requiring every single `TEST_DEVICE` call to initialize
`udev_properties`.
(cherry picked from commit b71a1b6e2d)
This commit is contained in:
parent
c8daa2c0a1
commit
a7d2b749f3
1 changed files with 1 additions and 1 deletions
|
|
@ -77,7 +77,7 @@ struct litest_test_device {
|
|||
const char *udev_rule;
|
||||
const char *quirk_file;
|
||||
|
||||
const struct key_value_str udev_properties[];
|
||||
const struct key_value_str udev_properties[32];
|
||||
};
|
||||
|
||||
struct litest_device_interface {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue