NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
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 <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
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 == NULL) ||
(BufferSize == NULL) ||
(ServerIp == NULL) ||
- ((BufferPtr == NULL) && DontUseBuffer) ||
((BlockSize != NULL) && (*BlockSize < PXE_MTFTP_DEFAULT_BLOCK_SIZE))) {
return EFI_INVALID_PARAMETER;
}
+ if (Operation == EFI_PXE_BASE_CODE_TFTP_READ_FILE ||
+ Operation == EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY ||
+ Operation == EFI_PXE_BASE_CODE_MTFTP_READ_FILE ||
+ Operation == EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY) {
+ if (BufferPtr == NULL && !DontUseBuffer) {
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
Config = NULL;
Status = EFI_DEVICE_ERROR;
Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This);
--
2.13.0.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> > -----Original Message----- > From: Fu, Siyuan > Sent: Thursday, January 11, 2018 5:19 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Wang, > Fan <fan.wang@intel.com> > Subject: [Patch] NetworkPkg: Fix incorrect parameter check in PXE.Mtftp() > function. > > 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 <ting.ye@intel.com> > Cc: Wu Jiaxin <jiaxin.wu@intel.com> > Cc: Wang Fan <fan.wang@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> > --- > 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 == NULL) || > (BufferSize == NULL) || > (ServerIp == NULL) || > - ((BufferPtr == NULL) && DontUseBuffer) || > ((BlockSize != NULL) && (*BlockSize < > PXE_MTFTP_DEFAULT_BLOCK_SIZE))) { > return EFI_INVALID_PARAMETER; > } > > + if (Operation == EFI_PXE_BASE_CODE_TFTP_READ_FILE || > + Operation == EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY || > + Operation == EFI_PXE_BASE_CODE_MTFTP_READ_FILE || > + Operation == EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY) { > + if (BufferPtr == NULL && !DontUseBuffer) { > + return EFI_INVALID_PARAMETER; > + } > + } > + > Config = NULL; > Status = EFI_DEVICE_ERROR; > Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This); > -- > 2.13.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.