Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2783564pxb; Sat, 6 Feb 2021 07:37:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzo/jQIO9ax3Dt1VtoRnUS3wJjd+lb9zLdQeZGbWyPqdm05NekG+t8k6KIWpoJRPyFvlzw X-Received: by 2002:a17:907:98d7:: with SMTP id kd23mr9354048ejc.283.1612625848799; Sat, 06 Feb 2021 07:37:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612625848; cv=none; d=google.com; s=arc-20160816; b=h9S2KF0y7/Egm9lPeBuGocWa5EFOtWT0G9/RERUn7IPygAdxpXSi63G9lIJE8d5tww HQSTI04pTnBWKWCciGp6f9Zx9a/FQnBHf324TNmpsz3BjJVAYwT/g8Ju+nXt6EAwO/I1 wgRKAyaoqHPIIfwCxBfSc1D7Q8rPJWDkoo1lGrPfDNfv/zQrlPgFJ1XpiNxMg1L2qp7n NtA9UpY/V7XWDhOyagQjnxNNKYlo30VzbYC2T8ZvXri7vfyO6DwZj0E7zyW3t+3mOvjI W5grCfQ0PX/9+JsCvaVY9RazaT5bMGZ5fQdwRiTw8KKGbj8K+zgPhsEWylnDZ0PxpwB6 A9Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=UeDa974hcPyKt7j/cikiKwvn9BJvQsyJtsh9Ivc5MHE=; b=f5We84eBXhjf1tH9Fwv8oKqCsKcjQtv6gRrHwqtABnoN7xtZmA5pfjUg938S0oOcrd xBxFgTj2Qla6CPuf8WTDIBWyV+nbuRIZiOOxd1puSxFV1g52xtk5bzkpDNrlnFePT89F 8L75o6cNHWnMF2JTTmN7h4QnLuoMA2TLKaxB5Gq+fIiXtix4zYtjtZoAhF64DYPh0ov4 EeQ6J//Tyu8Ht5sDS9mAEqTk+q5rjdcNMMUqPkfrOxIMLjSHucrIalwKrwIdIgdUW9jW yhLahobCIh+gGpSfMqYTCDCdmvK6grE17TVqyl2D4EwaX78DJMg1jfYk47jR7MPHiTnT GmLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si5244569edr.441.2021.02.06.07.37.05; Sat, 06 Feb 2021 07:37:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230179AbhBFPfV (ORCPT + 99 others); Sat, 6 Feb 2021 10:35:21 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:40988 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229715AbhBFPfQ (ORCPT ); Sat, 6 Feb 2021 10:35:16 -0500 Received: from isengard.fritz.box (unknown [87.147.51.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 3E9C5580060; Sat, 6 Feb 2021 16:34:34 +0100 (CET) From: Markus Theil To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Markus Theil Subject: [PATCH 2/3] rfkill.c: deal with updated struct size Date: Sat, 6 Feb 2021 16:34:10 +0100 Message-Id: <20210206153411.19097-2-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210206153411.19097-1-markus.theil@tu-ilmenau.de> References: <20210206153411.19097-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Signed-off-by: Markus Theil --- 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