From 1bee8ec6f873cbb8b569f5c65f998594295fe86e Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 1 Jul 2017 09:15:12 +0100 Subject: rfkill: use back and forward compatible test The rfkill_event struct might grow in future, so ensure the read sizes are at least the minimum, and allow it to be more. Reference: https://github.com/torvalds/linux/blob/master/include/uapi/linux/rfkill.h#L90-L102 Signed-off-by: Sami Kerola --- sys-utils/rfkill.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys-utils/rfkill.c') diff --git a/sys-utils/rfkill.c b/sys-utils/rfkill.c index 7d059a0ff..2f744ecf6 100644 --- a/sys-utils/rfkill.c +++ b/sys-utils/rfkill.c @@ -170,8 +170,8 @@ static int rfkill_event(void) break; } - if (len != RFKILL_EVENT_SIZE_V1) { - warnx(_("wrong size of rfkill event: %zu != %d"), len, RFKILL_EVENT_SIZE_V1); + if (len < RFKILL_EVENT_SIZE_V1) { + warnx(_("wrong size of rfkill event: %zu < %d"), len, RFKILL_EVENT_SIZE_V1); ret = 1; continue; } @@ -348,8 +348,8 @@ static int rfkill_list(struct control const *const ctrl, const char *param) break; } - if (len != RFKILL_EVENT_SIZE_V1) { - warnx(_("wrong size of rfkill event: %zu != %d"), len, RFKILL_EVENT_SIZE_V1); + if (len < RFKILL_EVENT_SIZE_V1) { + warnx(_("wrong size of rfkill event: %zu < %d"), len, RFKILL_EVENT_SIZE_V1); continue; } -- cgit v1.2.3-55-g7522