Search Linux Wireless

[PATCH 2/3] rfkill.c: deal with updated struct size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Markus Theil <markus.theil@xxxxxxxxxxxxx>
---
 rfkill.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/rfkill.c b/rfkill.c
index 8cd81fe..6b5ca2c 100644
--- a/rfkill.c
+++ b/rfkill.c
@@ -45,13 +45,14 @@ static void rfkill_event(void)
 		if (n == 0)
 			continue;
 
+		memset(&event, 0, sizeof(event));
 		len = read(fd, &event, sizeof(event));
 		if (len < 0) {
 			perror("Reading of RFKILL events failed");
 			break;
 		}
 
-		if (len != RFKILL_EVENT_SIZE_V1) {
+		if (len < RFKILL_EVENT_SIZE_V1) {
 			fprintf(stderr, "Wrong size of RFKILL event\n");
 			continue;
 		}
@@ -206,6 +207,7 @@ static int rfkill_list(const char *param)
 	}
 
 	while (1) {
+		memset(&event, 0, sizeof(event));
 		len = read(fd, &event, sizeof(event));
 		if (len < 0) {
 			if (errno == EAGAIN)
@@ -214,7 +216,7 @@ static int rfkill_list(const char *param)
 			break;
 		}
 
-		if (len != RFKILL_EVENT_SIZE_V1) {
+		if (len < RFKILL_EVENT_SIZE_V1) {
 			fprintf(stderr, "Wrong size of RFKILL event\n");
 			continue;
 		}
-- 
2.30.0




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux