diff options
author | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-06-24 15:19:44 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-06-27 10:11:46 +0800 |
commit | 6771c1d65885d7e9a0dd0e5878a41b05df178420 (patch) | |
tree | e4fb0146981f3e1387f909e4dbc05ab102c1cd1e /NetworkPkg/IpSecDxe/IkePacket.c | |
parent | 9252d67ab3007601ddf983d1278cbe0e4a647f34 (diff) | |
download | edk2-platforms-6771c1d65885d7e9a0dd0e5878a41b05df178420.tar.xz |
NetworkPkg: Avoid potential NULL pointer dereference
The commit of 6b16c9e7 removes ASSERT and use error handling
in IpSecDxe driver, but may cause the potential NULL pointer
dereference. So, this patch is used to avoid NULL pointer
dereference.
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Diffstat (limited to 'NetworkPkg/IpSecDxe/IkePacket.c')
-rw-r--r-- | NetworkPkg/IpSecDxe/IkePacket.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/NetworkPkg/IpSecDxe/IkePacket.c b/NetworkPkg/IpSecDxe/IkePacket.c index 8fd395d43f..14dbb9d5d6 100644 --- a/NetworkPkg/IpSecDxe/IkePacket.c +++ b/NetworkPkg/IpSecDxe/IkePacket.c @@ -1,7 +1,7 @@ /** @file
IKE Packet related operation.
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -195,6 +195,9 @@ IkeNetbufFromPacket ( LIST_ENTRY *PacketEntry;
LIST_ENTRY *Entry;
IKE_PAYLOAD *IkePayload;
+ EFI_STATUS RetStatus;
+
+ RetStatus = EFI_SUCCESS;
if (!IkePacket->IsEncoded) {
IkePacket->IsEncoded = TRUE;
@@ -203,10 +206,14 @@ IkeNetbufFromPacket ( // Encryption payloads if needed
//
if (((IKEV2_SESSION_COMMON *) SessionCommon)->IkeVer == 2) {
- Ikev2EncodePacket ((IKEV2_SESSION_COMMON *) SessionCommon, IkePacket, IkeType);
+ RetStatus = Ikev2EncodePacket ((IKEV2_SESSION_COMMON *) SessionCommon, IkePacket, IkeType);
+ if (EFI_ERROR (RetStatus)) {
+ return NULL;
+ }
+
} else {
//
- //If IKEv1 support, check it here.
+ // If IKEv1 support, check it here.
//
return NULL;
}
|