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 d02a848e32
commit cf9ff46b08
1 changed files with 9 additions and 1 deletions

View File

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