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>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
/** @file\r
Network library functions providing net buffer operation support.\r
\r
-Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
\r
NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE);\r
\r
+ if (Len == 0 || Nbuf->TotalSize == 0) {\r
+ return 0;\r
+ }\r
+\r
if (Len > Nbuf->TotalSize) {\r
Len = Nbuf->TotalSize;\r
}\r