From patchwork Tue May 9 19:04:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaap Keuter X-Patchwork-Id: 760302 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wMpjX64fTz9ryb for ; Wed, 10 May 2017 05:05:36 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DO2uVvQh"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=i8qpFzzzPcgecB8guBDqSqCD/Qhmfa1oSadEgf3k6yg=; b=DO2 uVvQhVE6Q3HbDcgEjOnkpbLp094NrZLAX2RRhOsMJRwjbx2XlZl4ey9rkc5H0dUy7pe8KBqbpY3n+ o3OuNphIE3lMyJW1DY9nQGMmC1dsS6pZuM6zc8bIb07pqVr1OxmNkbuyGmb+QtU9RMaD3qbenVCn1 vHiE8WHSnyn5ZnZj9pAKgOIgzxlSqLuYNDdWy+LpcO3Z3u2pIk27l5aIMyE49j67p3HWbq/hfCNkh AJymWYKgbXouyUz/E8HuxD4wzrZHNUb18yH8ZlnNDao/GehRXh5LhYLa0bpUrxJb5tHvaBuxHYLmi g6ZzFirG+ytLRQfGPrSEmL76I5VSChw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d8ARy-0003yT-CH; Tue, 09 May 2017 19:05:34 +0000 Received: from lb1-smtp-cloud3.xs4all.net ([194.109.24.22]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d8ARv-0003vZ-70 for hostap@lists.infradead.org; Tue, 09 May 2017 19:05:33 +0000 Received: from janus.fritz.box ([IPv6:2001:980:90d6:1:21e:8cff:fe01:3479]) by smtp-cloud3.xs4all.net with ESMTP id JK501v0093hZV0e01K55qK; Tue, 09 May 2017 21:05:06 +0200 From: Jaap Keuter To: hostap@lists.infradead.org Subject: [PATCH] Handle preshared CKN sizes from 1 to 32 octets Date: Tue, 9 May 2017 21:04:49 +0200 Message-Id: <20170509190449.7947-1-jaap.keuter@xs4all.nl> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170509_120531_401091_D42EE4CC X-CRM114-Status: UNSURE ( 8.44 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [194.109.24.22 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [194.109.24.22 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaap Keuter MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org IEEE802.1X-2010 section 9.3.1 states that the CKN comprises of 1 to 32 octets, and no further restrictions are placed on it. Therefore change the code reading the preshared CKN so that these sizes are accepted. Signed-off-by: Jaap Keuter --- wpa_supplicant/config.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 9ef11d86d..a4ff7f998 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -1898,8 +1898,16 @@ static int wpa_config_parse_mka_ckn(const struct parse_data *data, struct wpa_ssid *ssid, int line, const char *value) { - if (hexstr2bin(value, ssid->mka_ckn, MACSEC_CKN_LEN) || - value[MACSEC_CKN_LEN * 2] != '\0') { + size_t ckn_str_len = os_strlen(value); + + if (ckn_str_len == 0 || (ckn_str_len & 1) == 1 || + ckn_str_len > MACSEC_CKN_LEN * 2) { + wpa_printf(MSG_ERROR, "Line %d: Invalid size MKA-CKN '%s'.", + line, value); + return -1; + } + + if (hexstr2bin(value, ssid->mka_ckn, ckn_str_len / 2)) { wpa_printf(MSG_ERROR, "Line %d: Invalid MKA-CKN '%s'.", line, value); return -1;