]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use
authorJiaxin Wu <jiaxin.wu@intel.com>
Fri, 22 Dec 2017 03:28:42 +0000 (11:28 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Tue, 26 Dec 2017 08:43:24 +0000 (16:43 +0800)
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>
NetworkPkg/TcpDxe/TcpMain.c

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