summaryrefslogtreecommitdiff
path: root/NetworkPkg/HttpDxe/HttpImpl.c
diff options
context:
space:
mode:
authorZhang Lubo <lubo.zhang@intel.com>2015-11-30 03:22:27 +0000
committervanjeff <vanjeff@Edk2>2015-11-30 03:22:27 +0000
commitd76a00635f5061a96b6d17c1b68de9d2732fce55 (patch)
tree57e269fcf43f659362dd36a20f8d345daef42d68 /NetworkPkg/HttpDxe/HttpImpl.c
parent7b8985705ba2a0a8e9b5766eb7cb0a70dd41a103 (diff)
downloadedk2-platforms-d76a00635f5061a96b6d17c1b68de9d2732fce55.tar.xz
NetworkPkg:Fix NULL pointer dereference issues.
Revise some errors that some Null pointers may be dereferenced. (Sync patch r18961 from main trunk.) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19025 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'NetworkPkg/HttpDxe/HttpImpl.c')
-rw-r--r--NetworkPkg/HttpDxe/HttpImpl.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index ce28f07efa..f26d6f4f3f 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -39,6 +39,7 @@ EFI_HTTP_PROTOCOL mEfiHttpTemplate = {
This is NULL.
HttpConfigData is NULL.
HttpConfigData->AccessPoint is NULL.
+ @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources.
@retval EFI_NOT_STARTED The HTTP instance is not configured.
**/
@@ -70,6 +71,9 @@ EfiHttpGetModeData (
if (HttpInstance->LocalAddressIsIPv6) {
Http6AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv6_ACCESS_POINT));
+ if (Http6AccessPoint == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
CopyMem (
Http6AccessPoint,
&HttpInstance->Ipv6Node,
@@ -78,6 +82,9 @@ EfiHttpGetModeData (
HttpConfigData->AccessPoint.IPv6Node = Http6AccessPoint;
} else {
Http4AccessPoint = AllocateZeroPool (sizeof (EFI_HTTPv4_ACCESS_POINT));
+ if (Http4AccessPoint == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
CopyMem (
Http4AccessPoint,
&HttpInstance->IPv4Node,
@@ -886,6 +893,8 @@ HttpResponseWorker (
goto Error;
}
+ ASSERT (HttpHeaders != NULL);
+
//
// Cache the part of body.
//
@@ -1288,14 +1297,19 @@ EfiHttpPoll (
HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
ASSERT (HttpInstance != NULL);
- if (HttpInstance->State != HTTP_STATE_TCP_CONNECTED || (HttpInstance->Tcp4 == NULL &&
- HttpInstance->Tcp6 == NULL)) {
+ if (HttpInstance->State != HTTP_STATE_TCP_CONNECTED) {
return EFI_NOT_STARTED;
}
if (HttpInstance->LocalAddressIsIPv6) {
+ if (HttpInstance->Tcp6 == NULL) {
+ return EFI_NOT_STARTED;
+ }
Status = HttpInstance->Tcp6->Poll (HttpInstance->Tcp6);
} else {
+ if (HttpInstance->Tcp4 == NULL) {
+ return EFI_NOT_STARTED;
+ }
Status = HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);
}