public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jiaxin Wu <jiaxin.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Fu Siyuan <siyuan.fu@intel.com>, Wang Fan <fan.wang@intel.com>,
	Ye Ting <ting.ye@intel.com>, Wu Jiaxin <jiaxin.wu@intel.com>
Subject: [Patch 1/3] NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use
Date: Fri, 22 Dec 2017 15:07:17 +0800	[thread overview]
Message-ID: <1513926438-4160-2-git-send-email-jiaxin.wu@intel.com> (raw)
In-Reply-To: <1513926438-4160-1-git-send-email-jiaxin.wu@intel.com>

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>
---
 NetworkPkg/TcpDxe/TcpMain.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NetworkPkg/TcpDxe/TcpMain.c b/NetworkPkg/TcpDxe/TcpMain.c
index fc3713e..e349d2d 100644
--- a/NetworkPkg/TcpDxe/TcpMain.c
+++ b/NetworkPkg/TcpDxe/TcpMain.c
@@ -38,10 +38,13 @@ TcpChkDataBuf (
   UINT32 Index;
 
   UINT32 Len;
 
   for (Index = 0, Len = 0; Index < FragmentCount; Index++) {
+    if (FragmentTable[Index].FragmentBuffer == NULL) {
+      return EFI_INVALID_PARAMETER;
+    }
     Len = Len + FragmentTable[Index].FragmentLength;
   }
 
   if (DataLen != Len) {
     return EFI_INVALID_PARAMETER;
-- 
1.9.5.msysgit.1



  reply	other threads:[~2017-12-22  7:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22  7:07 [Patch 0/3] NetworkPkg/TcpDxe: Fix some issues in TcpDxe driver Jiaxin Wu
2017-12-22  7:07 ` Jiaxin Wu [this message]
2017-12-22  7:18   ` [Patch 1/3] NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use Fu, Siyuan
2017-12-22  7:07 ` [Patch 2/3] NetworkPkg/TcpDxe: Remove the redundant code Jiaxin Wu
2017-12-22  7:18   ` Fu, Siyuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513926438-4160-2-git-send-email-jiaxin.wu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox