From patchwork Thu Jun 8 08:17:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 772915 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 3wjyzv41K6z9s7t for ; Thu, 8 Jun 2017 18:20:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="M+LMSXOd"; 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=N9yolyTNU5EtCaGuboEHWQLgj3XqT4Dff5QKBSrU6Ms=; b=M+L MSXOd4n6b38flaHJInK3CY/QoCfJDcp5VdJDTSNQlOdIGkxnjwAGh0tquYUzUL9sM+HPGYxFgTWrz uN8tI9BKiIdqdLrLXsbzYDNOJhxdSbjio0vRf4o2XQYBXI+wItHnvVn8zDQVbZEAMuquNAUong2A1 7c50WYoIFwM4Wtvb6ZE72m1bkjKa44P2b/uRTrN+t8q4tg/Z33sylvEN9azBVxTlQA9VXjVgwfX4J Aj351VgoFSm+LJQfycS881X6JNiRy1gsMHxry8tzLtQ2pRRITfOxtJ0cu6vWfKVgnmfh5ozBD7396 ZcvgcV05BywGt0XrtAEgQprmPHvJoaw==; 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 1dIsgP-0006Aq-Js; Thu, 08 Jun 2017 08:20:45 +0000 Received: from mga01.intel.com ([192.55.52.88]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dIsfi-0004Pv-WB for hostap@lists.infradead.org; Thu, 08 Jun 2017 08:20:05 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jun 2017 01:19:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.39,314,1493708400"; d="scan'208"; a="1179822149" Received: from temphostname.jer.intel.com ([10.12.217.219]) by fmsmga002.fm.intel.com with ESMTP; 08 Jun 2017 01:19:44 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Subject: [PATCH] EAP: Fix possible memory leak in eap_ttls_phase2_request_mschap() Date: Thu, 8 Jun 2017 11:17:59 +0300 Message-Id: <1496909880-3511-6-git-send-email-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170608_012003_074283_2BB55070 X-CRM114-Status: UNSURE ( 9.16 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.55.52.88 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -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_H3 RBL: Good reputation (+3) [192.55.52.88 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.0 T_FILL_THIS_FORM_SHORT Fill in a short form with personal information 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: Ilan Peer MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Ilan Peer Signed-off-by: Ilan Peer --- src/eap_peer/eap_ttls.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/eap_peer/eap_ttls.c b/src/eap_peer/eap_ttls.c index 01112b5..c8a05fd 100644 --- a/src/eap_peer/eap_ttls.c +++ b/src/eap_peer/eap_ttls.c @@ -625,15 +625,25 @@ static int eap_ttls_phase2_request_mschap(struct eap_sm *sm, pos += 24; if (pwhash) { /* NT-Response */ - if (challenge_response(challenge, password, pos)) + if (challenge_response(challenge, password, pos)) { + wpa_printf(MSG_ERROR, + "EAP-TTLS/MSCHAP: Failed derive password hash"); + wpabuf_free(msg); return -1; + } + wpa_hexdump_key(MSG_DEBUG, "EAP-TTLS: MSCHAP password hash", password, 16); } else { /* NT-Response */ if (nt_challenge_response(challenge, password, password_len, - pos)) + pos)) { + wpa_printf(MSG_ERROR, + "EAP-TTLS/MSCHAP: Failed derive password"); + wpabuf_free(msg); return -1; + } + wpa_hexdump_ascii_key(MSG_DEBUG, "EAP-TTLS: MSCHAP password", password, password_len); }