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.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
This commit is contained in:
Fu Siyuan
2018-01-09 15:08:57 +08:00
parent dea2caf4b9
commit 2b5c3808f5

View File

@@ -855,11 +855,19 @@ EfiPxeBcMtftp (
(Filename == NULL) || (Filename == NULL) ||
(BufferSize == NULL) || (BufferSize == NULL) ||
(ServerIp == NULL) || (ServerIp == NULL) ||
((BufferPtr == NULL) && DontUseBuffer) ||
((BlockSize != NULL) && (*BlockSize < PXE_MTFTP_DEFAULT_BLOCK_SIZE))) { ((BlockSize != NULL) && (*BlockSize < PXE_MTFTP_DEFAULT_BLOCK_SIZE))) {
return EFI_INVALID_PARAMETER; 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; Config = NULL;
Status = EFI_DEVICE_ERROR; Status = EFI_DEVICE_ERROR;
Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This); Private = PXEBC_PRIVATE_DATA_FROM_PXEBC (This);