[gnome-settings-daemon/benzea/fix-read-len-check] rfkill: Fix rfkill event read length check
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/benzea/fix-read-len-check] rfkill: Fix rfkill event read length check
- Date: Wed, 14 Apr 2021 09:58:20 +0000 (UTC)
commit 3005613575028d3f0739f462c0938c95847e152c
Author: Benjamin Berg <bberg redhat com>
Date: Wed Apr 14 11:55:51 2021 +0200
rfkill: Fix rfkill event read length check
The kernel may return a short read for rfkill events in case it is using
an older API version while g-s-d was compiled using the newer struct. As
this is perfectly valid, we need to check the read length against
RFKILL_EVENT_SIZE_V1 rather than the size of the struct.
plugins/rfkill/rfkill-glib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/plugins/rfkill/rfkill-glib.c b/plugins/rfkill/rfkill-glib.c
index 22309dce..ce055099 100644
--- a/plugins/rfkill/rfkill-glib.c
+++ b/plugins/rfkill/rfkill-glib.c
@@ -351,7 +351,7 @@ event_cb (GIOChannel *source,
&read,
NULL);
- while (status == G_IO_STATUS_NORMAL && read == sizeof(event)) {
+ while (status == G_IO_STATUS_NORMAL && read >= RFKILL_EVENT_SIZE_V1) {
struct rfkill_event *event_ptr;
print_event (&event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]