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);