From nobody Mon Dec 23 13:31:30 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 1515662320526723.0327055545329; Thu, 11 Jan 2018 01:18:40 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 555E02205B90C; Thu, 11 Jan 2018 01:13:25 -0800 (PST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 179F02205B907 for ; Thu, 11 Jan 2018 01:13:24 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2018 01:18:37 -0800 Received: from sfu5-mobl.ccr.corp.intel.com ([10.239.192.215]) by orsmga003.jf.intel.com with ESMTP; 11 Jan 2018 01:18:35 -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=134.134.136.65; helo=mga03.intel.com; envelope-from=siyuan.fu@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.46,343,1511856000"; d="scan'208";a="19235324" From: Fu Siyuan To: edk2-devel@lists.01.org Date: Thu, 11 Jan 2018 17:18:30 +0800 Message-Id: <20180111091830.9724-1-siyuan.fu@intel.com> X-Mailer: git-send-email 2.13.0.windows.1 Subject: [edk2] [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: , Cc: Ye Ting , Wang Fan , 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" According to UEFI spec, the PXE.Mtftp() should return invalid parameter if = the BufferPtr parameter was NULL and the DontUseBuffer parameter was FALSE. The DontUseBuffer is only used when perform MTFTP/TFTP read operation. Cc: Ye Ting Cc: Wu Jiaxin Cc: Wang Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan Reviewed-by: Jiaxin Wu --- NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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); --=20 2.13.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel