summaryrefslogtreecommitdiff
path: root/NetworkPkg/IpSecDxe/Ikev2/Payload.c
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2016-06-24 15:19:44 +0800
committerHao Wu <hao.a.wu@intel.com>2016-07-07 15:00:53 +0800
commiteb7d1a38b2f81ce19d90e287fdfd4bdf2dc26726 (patch)
treed99dd3096410dd9ae9ade6fe8ea275c334eb4a4a /NetworkPkg/IpSecDxe/Ikev2/Payload.c
parent8494eaf3091906401a0ff91f841962de41c9ebd7 (diff)
downloadedk2-platforms-eb7d1a38b2f81ce19d90e287fdfd4bdf2dc26726.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> (cherry picked from commit 6771c1d65885d7e9a0dd0e5878a41b05df178420)
Diffstat (limited to 'NetworkPkg/IpSecDxe/Ikev2/Payload.c')
-rw-r--r--NetworkPkg/IpSecDxe/Ikev2/Payload.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/NetworkPkg/IpSecDxe/Ikev2/Payload.c b/NetworkPkg/IpSecDxe/Ikev2/Payload.c
index d5fe1abb55..675ecf6f74 100644
--- a/NetworkPkg/IpSecDxe/Ikev2/Payload.c
+++ b/NetworkPkg/IpSecDxe/Ikev2/Payload.c
@@ -2558,6 +2558,9 @@ Ikev2EncodePacket (
// Encrypt all payload and transfer IKE packet header from Host order to Network order.
//
Status = Ikev2EncryptPacket (SessionCommon, IkePacket);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
} else {
//
// Fill in the lenght into IkePacket header and transfer Host order to Network order.