mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/DxeNetLib: Check the actual packet size before trim data from Nbuf.
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>
This commit is contained in:
parent
85974aef13
commit
b07bbb4f73
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Network library functions providing net buffer operation support.
|
Network library functions providing net buffer operation support.
|
||||||
|
|
||||||
Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -1175,6 +1175,10 @@ NetbufTrim (
|
||||||
|
|
||||||
NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE);
|
NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE);
|
||||||
|
|
||||||
|
if (Len == 0 || Nbuf->TotalSize == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (Len > Nbuf->TotalSize) {
|
if (Len > Nbuf->TotalSize) {
|
||||||
Len = Nbuf->TotalSize;
|
Len = Nbuf->TotalSize;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue