diff options
author | Sami Kerola | 2017-07-01 10:15:12 +0200 |
---|---|---|
committer | Sami Kerola | 2017-08-30 21:32:49 +0200 |
commit | 1bee8ec6f873cbb8b569f5c65f998594295fe86e (patch) | |
tree | d3e9829a220e182a52559823e8587aa276a6a950 /sys-utils | |
parent | rfkill: add bash-completion file (diff) | |
download | kernel-qcow2-util-linux-1bee8ec6f873cbb8b569f5c65f998594295fe86e.tar.gz kernel-qcow2-util-linux-1bee8ec6f873cbb8b569f5c65f998594295fe86e.tar.xz kernel-qcow2-util-linux-1bee8ec6f873cbb8b569f5c65f998594295fe86e.zip |
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 <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/rfkill.c | 8 |
1 files changed, 4 insertions, 4 deletions
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; } |