From: Fu Siyuan <siyuan.fu@intel.com>
To: edk2-devel@lists.01.org
Cc: Wu Jiaxin <jiaxin.wu@intel.com>, Ye Ting <ting.ye@intel.com>,
Michael Turner <Michael.Turner@microsoft.com>
Subject: [Patch] MdeModulePkg/DxeNetLib: Check the actual packet size before trim data from Nbuf.
Date: Wed, 20 Sep 2017 11:23:57 +0800 [thread overview]
Message-ID: <20170920032357.5864-1-siyuan.fu@intel.com> (raw)
In NetbufTrim() function, the NetBuf TotalSize should be checked with 0 before
making the trim operation, otherwise the function will fall into infinite loop.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
---
MdeModulePkg/Library/DxeNetLib/NetBuffer.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/MdeModulePkg/Library/DxeNetLib/NetBuffer.c b/MdeModulePkg/Library/DxeNetLib/NetBuffer.c
index 95cb71714b..25fc78e49e 100644
--- a/MdeModulePkg/Library/DxeNetLib/NetBuffer.c
+++ b/MdeModulePkg/Library/DxeNetLib/NetBuffer.c
@@ -1175,6 +1175,10 @@ NetbufTrim (
NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE);
+ if (Nbuf->TotalSize == 0) {
+ return 0;
+ }
+
if (Len > Nbuf->TotalSize) {
Len = Nbuf->TotalSize;
}
--
2.13.0.windows.1
next reply other threads:[~2017-09-20 3:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 3:23 Fu Siyuan [this message]
2017-09-20 8:16 ` [Patch] MdeModulePkg/DxeNetLib: Check the actual packet size before trim data from Nbuf Wu, Jiaxin
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=20170920032357.5864-1-siyuan.fu@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