Skip to content

Commit

Permalink
NetworkPkg: Fix incorrect parameter check in PXE.Mtftp() function.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Jiaxin Wu <[email protected]>
  • Loading branch information
sfu5 committed Jan 15, 2018
1 parent d02a848 commit cf9ff46
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cf9ff46

Please sign in to comment.