summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/TcpDxe
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2017-12-22 11:28:42 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2017-12-26 16:43:24 +0800
commit8b40f01a3f03c16897a01b827b7e3e8943274aac (patch)
tree07a8605adecd33d2a3b347318cec622a64d67300 /NetworkPkg/TcpDxe
parent5644e5cecebeeefea90cfda093df68e0aa6e0361 (diff)
downloadedk2-8b40f01a3f03c16897a01b827b7e3e8943274aac.tar.gz
edk2-8b40f01a3f03c16897a01b827b7e3e8943274aac.tar.bz2
edk2-8b40f01a3f03c16897a01b827b7e3e8943274aac.zip
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>
Diffstat (limited to 'NetworkPkg/TcpDxe')
-rw-r--r--NetworkPkg/TcpDxe/TcpMain.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/NetworkPkg/TcpDxe/TcpMain.c b/NetworkPkg/TcpDxe/TcpMain.c
index fc3713e533..e349d2dce6 100644
--- a/NetworkPkg/TcpDxe/TcpMain.c
+++ b/NetworkPkg/TcpDxe/TcpMain.c
@@ -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;
}