From nobody Sun May 19 01:15:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1513839055334797.1272413564727; Wed, 20 Dec 2017 22:50:55 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 99DFC22212C16; Wed, 20 Dec 2017 22:46:05 -0800 (PST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E7F9D208F7A23 for ; Wed, 20 Dec 2017 22:46:02 -0800 (PST) Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2017 22:50:51 -0800 Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.141]) by fmsmga007.fm.intel.com with ESMTP; 20 Dec 2017 22:50:50 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,434,1508828400"; d="scan'208";a="4074946" From: Jiaxin Wu To: edk2-devel@lists.01.org Date: Thu, 21 Dec 2017 14:50:46 +0800 Message-Id: <1513839047-15032-2-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1513839047-15032-1-git-send-email-jiaxin.wu@intel.com> References: <1513839047-15032-1-git-send-email-jiaxin.wu@intel.com> Subject: [edk2] [Patch 1/2] NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror happen. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ye Ting , Wang Fan , Fu Siyuan , Wu Jiaxin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Wang Fan Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 3 +++ NetworkPkg/HttpBootDxe/HttpBootImpl.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c b/NetworkPkg/HttpBootDx= e/HttpBootDhcp4.c index a8cee04..421ce6e 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c +++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c @@ -420,10 +420,13 @@ HttpBootParseDhcp4Packet ( =20 } else { if (!IsProxyOffer) { OfferType =3D IsDnsOffer ? HttpOfferTypeDhcpDns : HttpOfferTypeDhcpO= nly; } else { + if (Cache4->UriParser !=3D NULL) { + FreePool (Cache4->UriParser); + } return EFI_DEVICE_ERROR; } } =20 Cache4->OfferType =3D OfferType; diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe= /HttpBootImpl.c index 7f0616d..d4b46a6 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c @@ -120,12 +120,13 @@ HttpBootStart ( ) { UINTN Index; EFI_STATUS Status; CHAR8 *Uri; - =20 =20 + Uri =3D NULL; + =20 if (Private =3D=3D NULL || FilePath =3D=3D NULL) { return EFI_INVALID_PARAMETER; } =20 // @@ -152,10 +153,13 @@ HttpBootStart ( // // Restart is required, first stop then continue this start function. // Status =3D HttpBootStop (Private); if (EFI_ERROR (Status)) { + if (Uri !=3D NULL) { + FreePool (Uri); + } return Status; } } else { // // Restart is not required. --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sun May 19 01:15:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1513839057060822.25044110869; Wed, 20 Dec 2017 22:50:57 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EEE03222447C3; Wed, 20 Dec 2017 22:46:05 -0800 (PST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5A3092219BC89 for ; Wed, 20 Dec 2017 22:46:04 -0800 (PST) Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2017 22:50:52 -0800 Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.141]) by fmsmga007.fm.intel.com with ESMTP; 20 Dec 2017 22:50:51 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,434,1508828400"; d="scan'208";a="4074953" From: Jiaxin Wu To: edk2-devel@lists.01.org Date: Thu, 21 Dec 2017 14:50:47 +0800 Message-Id: <1513839047-15032-3-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1513839047-15032-1-git-send-email-jiaxin.wu@intel.com> References: <1513839047-15032-1-git-send-email-jiaxin.wu@intel.com> Subject: [edk2] [Patch 2/2] NetworkPkg/HttpBootDxe: Break the HttpBoot Callback function when meet redirect status. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ye Ting , Wang Fan , Fu Siyuan , Wu Jiaxin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In HttpBootCallback(), when data type is HttpBootHttpResponse, function may= meet the resource redirect error. In current implementation, function will still= go ahead to find header for HTTP_HEADER_CONTENT_LENGTH, this is not expected. = Function should break in redirect status error handling. Cc: Wang Fan Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- NetworkPkg/HttpBootDxe/HttpBootImpl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe= /HttpBootImpl.c index d4b46a6..16c1207 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c @@ -709,10 +709,11 @@ HttpBootCallback ( HTTP_HEADER_LOCATION ); if (HttpHeader !=3D NULL) { Print (L"\n HTTP ERROR: Resource Redirected.\n New Location:= %a\n", HttpHeader->FieldValue); } + break;=20 } } =20 HttpHeader =3D HttpFindHeader ( HttpMessage->HeaderCount, --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel