summaryrefslogtreecommitdiffstats
path: root/sys-utils/rfkill.c
diff options
context:
space:
mode:
authorSami Kerola2017-07-01 10:15:12 +0200
committerSami Kerola2017-08-30 21:32:49 +0200
commit1bee8ec6f873cbb8b569f5c65f998594295fe86e (patch)
treed3e9829a220e182a52559823e8587aa276a6a950 /sys-utils/rfkill.c
parentrfkill: add bash-completion file (diff)
downloadkernel-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/rfkill.c')
-rw-r--r--sys-utils/rfkill.c8
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;
}