From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 36B0A21F833A9 for ; Thu, 11 Jan 2018 16:41:38 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2018 16:46:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,346,1511856000"; d="scan'208";a="10124135" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga008.jf.intel.com with ESMTP; 11 Jan 2018 16:46:52 -0800 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 11 Jan 2018 16:46:51 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 11 Jan 2018 16:46:51 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Fri, 12 Jan 2018 08:46:49 +0800 From: "Wu, Jiaxin" To: "Fu, Siyuan" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Wang, Fan" Thread-Topic: [Patch] NetworkPkg: Fix incorrect parameter check in PXE.Mtftp() function. Thread-Index: AQHTir0vyc4g83OfnUS+lbGnrpp11qNvaBxA Date: Fri, 12 Jan 2018 00:46:49 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B72741635C630@SHSMSX103.ccr.corp.intel.com> References: <20180111091830.9724-1-siyuan.fu@intel.com> In-Reply-To: <20180111091830.9724-1-siyuan.fu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWYwN2UxNTQtYjhkYi00NTVjLThhMjUtODFiNDZkZGMzNTI3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IkV2UmZ3N0JvWnliaXZzcTc1QitsVFJ1SDFUalpoQ2RSOFQyRFVQNVBoQTg9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] NetworkPkg: Fix incorrect parameter check in PXE.Mtftp() function. 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: , X-List-Received-Date: Fri, 12 Jan 2018 00:41:38 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiaxin Wu > -----Original Message----- > From: Fu, Siyuan > Sent: Thursday, January 11, 2018 5:19 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting ; Wu, Jiaxin ; Wang, > Fan > Subject: [Patch] NetworkPkg: Fix incorrect parameter check in PXE.Mtftp() > function. >=20 > According to UEFI spec, the PXE.Mtftp() should return invalid parameter i= f > the > BufferPtr parameter was NULL and the DontUseBuffer parameter was FALSE. > The DontUseBuffer is only used when perform MTFTP/TFTP read operation. >=20 > Cc: Ye Ting > Cc: Wu Jiaxin > Cc: Wang Fan > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Fu Siyuan > --- > NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) >=20 > diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c > b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c > index 93f3bfa5ba..9068e0686c 100644 > --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c > +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c > @@ -855,11 +855,19 @@ EfiPxeBcMtftp ( > (Filename =3D=3D NULL) || > (BufferSize =3D=3D NULL) || > (ServerIp =3D=3D NULL) || > - ((BufferPtr =3D=3D NULL) && DontUseBuffer) || > ((BlockSize !=3D NULL) && (*BlockSize < > PXE_MTFTP_DEFAULT_BLOCK_SIZE))) { > return EFI_INVALID_PARAMETER; > } >=20 > + if (Operation =3D=3D EFI_PXE_BASE_CODE_TFTP_READ_FILE || > + Operation =3D=3D EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY || > + Operation =3D=3D EFI_PXE_BASE_CODE_MTFTP_READ_FILE || > + Operation =3D=3D EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY) { > + if (BufferPtr =3D=3D NULL && !DontUseBuffer) { > + return EFI_INVALID_PARAMETER; > + } > + } > + > Config =3D NULL; > Status =3D EFI_DEVICE_ERROR; > Private =3D PXEBC_PRIVATE_DATA_FROM_PXEBC (This); > -- > 2.13.0.windows.1