mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
terminal: verify kernel-returned DRM events are not truncated
Make sure the kernel always returns events properly. This is guaranteed right now, otherwise, we do something really wrong. But lets be sure and verify the received values properly. This also silences some coverity warnings.
This commit is contained in:
parent
c5e6bfc6bc
commit
a908d21355
@ -2223,7 +2223,7 @@ static int grdrm_card_io_fn(sd_event_source *s, int fd, uint32_t revents, void *
|
||||
for (i = 0; i < l; i += event->length) {
|
||||
event = (void*)&buf[i];
|
||||
|
||||
if (i + event->length > l) {
|
||||
if (i + (ssize_t)sizeof(*event) > l || i + (ssize_t)event->length > l) {
|
||||
log_debug("grdrm: %s/%s: truncated event", card->base.session->name, card->base.name);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user