From patchwork Wed Apr 3 15:17:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1075789 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Owk5U9Ul"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::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 44Z3dL3QD4z9sS3 for ; Wed, 3 Apr 2019 22:24:38 +1100 (AEDT) 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=TZauffnbki6ycvQQBIl/hv9Skp3K02DTZBJX4HJ8XxE=; b=Owk5U9UlpMz5q9 oWcYP2IxvETPgp2oxCKehJUhCJkNRPoviWGfTScPABGwnknKd3vBSyCHkyHUS7yil1GzTdC7hLdQH tmGdOlK0rUzsrUIaQrZMDklewv1cjFkUY6ciZj1NrWGiIL5XAq8krxfgpHpYwSdbITsHFmRosY2x6 P5fXHclL3F6FehZJxLONDjdQzb2Xh6CA8q89a+btDUO3utUyvQOGz58K0Z5xu5C6/uWOZXO8672eJ GVunYSFsEOqBCNK4uMsajVtF1o5UGZb3eVTJ8vfwfcyZdSlVmcvyyR5hZDBRkE18D8jlKsSGcoinE EHlnPOBB/O4OiAb4938w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBe0R-0005jQ-2l; Wed, 03 Apr 2019 11:24:35 +0000 Received: from mga14.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBe02-00059T-Qe for hostap@lists.infradead.org; Wed, 03 Apr 2019 11:24:15 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2019 04:24:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,304,1549958400"; d="scan'208";a="128260543" Received: from andrei-xps-12-9q33.jer.intel.com ([10.12.190.129]) by orsmga007.jf.intel.com with ESMTP; 03 Apr 2019 04:24:07 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Subject: [PATCH] AP: Fix potential NULL dereference in ieee802_1x_get_mib_sta() Date: Wed, 3 Apr 2019 18:17:16 +0300 Message-Id: <20190403151719.12165-6-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190403151719.12165-1-andrei.otcheretianski@intel.com> References: <20190403151719.12165-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190403_042411_434936_227594D6 X-CRM114-Status: GOOD ( 10.43 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [192.55.52.115 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 2.4 DATE_IN_FUTURE_03_06 Date: is 3 to 6 hours after Received: date 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: Andrei Otcheretianski Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org identity_buf may be NULL. Handle this case correctly. Signed-off-by: Andrei Otcheretianski --- src/ap/ieee802_1x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c index a56c82e564..870329a859 100644 --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c @@ -2733,7 +2733,8 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta, wpa_auth_sta_key_mgmt(sta->wpa_sm))) ? 1 : 2, (unsigned int) diff.sec, - sm->identity ? (char *) sm->identity : identity_buf); + sm->identity ? (char *) sm->identity : + (identity_buf ? identity_buf : "N/A")); os_free(identity_buf); if (os_snprintf_error(buflen - len, ret)) return len;