mirror of
https://github.com/systemd/systemd.git
synced 2026-08-09 09:32:04 +00:00
udev: avoid reading before empty capability masks
When input_id prints a decoded capability bitmap, an all-zero
bitmap can decrement the index to zero.
Check the index before reading bitmask[val - 1].
Reproducer:
udevadm test-builtin input_id with an all-zero capability mask
Follow-up:
912541b024
This commit is contained in:
@@ -118,7 +118,7 @@ static void get_cap_mask(
|
||||
|
||||
val = bitmask_size / sizeof (unsigned long);
|
||||
/* skip trailing zeros */
|
||||
while (bitmask[val-1] == 0 && val > 0)
|
||||
while (val > 0 && bitmask[val-1] == 0)
|
||||
--val;
|
||||
|
||||
/* IN_SET() cannot be used in assert_cc(). */
|
||||
|
||||
Reference in New Issue
Block a user