diff options
author | tye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-01-27 09:30:35 +0000 |
---|---|---|
committer | tye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-01-27 09:30:35 +0000 |
commit | 90f1486c8ebc891e3c69fc98d8efa372b0c4806c (patch) | |
tree | 255dc51954619abef00131658c52c9a6d01756ee | |
parent | 9aa7ba01aa6d3526f99a145415a91798b00d339a (diff) | |
download | edk2-platforms-90f1486c8ebc891e3c69fc98d8efa372b0c4806c.tar.xz |
1. Fix the potential issue in NetbufGetFragment() when Last is zero in Line 53.
2. Comments update.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9837 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | MdeModulePkg/Library/DxeNetLib/NetBuffer.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/MdeModulePkg/Library/DxeNetLib/NetBuffer.c b/MdeModulePkg/Library/DxeNetLib/NetBuffer.c index eadffbb45d..b56d62c8fb 100644 --- a/MdeModulePkg/Library/DxeNetLib/NetBuffer.c +++ b/MdeModulePkg/Library/DxeNetLib/NetBuffer.c @@ -1,7 +1,7 @@ /** @file
Network library functions providing net buffer operation support.
-Copyright (c) 2005 - 2009, Intel Corporation.<BR>
+Copyright (c) 2005 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
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
@@ -508,7 +508,6 @@ NetbufGetFragmentFree ( }
-
/**
Create a NET_BUF structure which contains Len byte data of Nbuf starting from
Offset.
@@ -579,9 +578,6 @@ NetbufGetFragment ( FirstSkip = Offset - Cur;
FirstLen = BlockOp[Index].Size - FirstSkip;
- //
- //redundant assignment to make compiler happy.
- //
Last = 0;
LastLen = 0;
@@ -605,6 +601,7 @@ NetbufGetFragment ( FirstLen = Len;
}
+ ASSERT (Last >= First);
BlockOpNum = Last - First + 1;
CurBlockOp = 0;
@@ -640,7 +637,7 @@ NetbufGetFragment ( Child->BlockOp[0].Size = 0;
CurBlockOp++;
- }else {
+ } else {
Child = NetbufAllocStruct (0, BlockOpNum);
if (Child == NULL) {
@@ -664,7 +661,7 @@ NetbufGetFragment ( CurBlockOp++
);
- for (Index = First + 1; Index <= Last - 1 ; Index++) {
+ for (Index = First + 1; Index < Last; Index++) {
NetbufSetBlockOp (
Child,
BlockOp[Index].Head,
|