From patchwork Mon Feb 10 12:06:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 11373081 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F04E138D for ; Mon, 10 Feb 2020 12:06:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A89A20838 for ; Mon, 10 Feb 2020 12:06:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727347AbgBJMGl (ORCPT ); Mon, 10 Feb 2020 07:06:41 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:52864 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbgBJMGl (ORCPT ); Mon, 10 Feb 2020 07:06:41 -0500 Received: from localhost.localdomain (unknown [109.41.129.64]) (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 3CEBD580074; Mon, 10 Feb 2020 13:06:39 +0100 (CET) From: Markus Theil To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Markus Theil Subject: [PATCH] iw: scan: more length checks for print_wifi_wps() Date: Mon, 10 Feb 2020 13:06:35 +0100 Message-Id: <20200210120635.498188-1-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Signed-off-by: Markus Theil --- scan.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scan.c b/scan.c index dbfe44c..2dedd64 100644 --- a/scan.c +++ b/scan.c @@ -1878,6 +1878,11 @@ static void print_wifi_wps(const uint8_t type, uint8_t len, const uint8_t *data, break; } case 0x103c: { + if (sublen < 1) { + printf("\t * RF Bands: (invalid " + "length %d)\n", sublen); + break; + } __u8 val = data[4]; tab_on_first(&first); printf("\t * RF Bands: 0x%x\n", val); @@ -1941,6 +1946,11 @@ static void print_wifi_wps(const uint8_t type, uint8_t len, const uint8_t *data, break; } case 0x1057: { + if (sublen < 1) { + printf("\t * AP setup locked: (invalid " + "length %d)\n", sublen); + break; + } __u8 val = data[4]; tab_on_first(&first); printf("\t * AP setup locked: 0x%.2x\n", val);