diff options
author | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-29 06:33:23 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-29 06:33:23 +0000 |
commit | 04eb20aa85f658b86dd8b6b4fc261d2c9ff2e6a3 (patch) | |
tree | 5c99c188718cfc42810f70ad1f7f6fe0d216e37c /MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c | |
parent | 57ad9d43b16aada77eaf6f6e1aaa0dd94f032bf2 (diff) | |
download | edk2-platforms-04eb20aa85f658b86dd8b6b4fc261d2c9ff2e6a3.tar.xz |
Add pointer check for NULL before dereference it.
Signed-off-by: ydong10
Reviewed-by: rsun3, lgao4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12472 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c')
-rw-r--r-- | MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c index 9cd1ae5cfc..0990d18035 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c @@ -419,7 +419,15 @@ Ip4Reassemble ( }
NewPacket->Ip.Ip4 = Assemble->Head;
- CopyMem (IP4_GET_CLIP_INFO (NewPacket), Assemble->Info, sizeof (*IP4_GET_CLIP_INFO (NewPacket)));
+
+ ASSERT (Assemble->Info != NULL);
+
+ CopyMem (
+ IP4_GET_CLIP_INFO (NewPacket),
+ Assemble->Info,
+ sizeof (*IP4_GET_CLIP_INFO (NewPacket))
+ );
+
return NewPacket;
}
@@ -1272,7 +1280,9 @@ Ip4InstanceDeliverPacket ( // headless. Trim the head off after copy. The IP head
// may be not continuous before the data.
//
- Head = NetbufAllocSpace (Dup, IP4_MAX_HEADLEN, NET_BUF_HEAD);
+ Head = NetbufAllocSpace (Dup, IP4_MAX_HEADLEN, NET_BUF_HEAD);
+ ASSERT (Head != NULL);
+
Dup->Ip.Ip4 = (IP4_HEAD *) Head;
CopyMem (Head, Packet->Ip.Ip4, Packet->Ip.Ip4->HeadLen << 2);
|