NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use

According the Spec, the FragmentBuffers in FragmentTable are allocated
by the application when calling Receive() function. This patch is to
check whether the FragmentBuffer is valid or not.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
This commit is contained in:
Jiaxin Wu 2017-12-22 11:28:42 +08:00
parent 5644e5cece
commit 8b40f01a3f

View File

@ -40,6 +40,9 @@ TcpChkDataBuf (
UINT32 Len;
for (Index = 0, Len = 0; Index < FragmentCount; Index++) {
if (FragmentTable[Index].FragmentBuffer == NULL) {
return EFI_INVALID_PARAMETER;
}
Len = Len + FragmentTable[Index].FragmentLength;
}