Reviewed-by: Zhang Lubo <[email protected]>

-----Original Message-----
From: Wu, Jiaxin 
Sent: Wednesday, May 25, 2016 4:28 PM
To: [email protected]
Cc: Ye, Ting <[email protected]>; Fu, Siyuan <[email protected]>; Zhang, Lubo 
<[email protected]>
Subject: [Patch 2/2] NetworkPkg: Correct HttpConfigure parameter check

When HttpConfigData is NULL, HttpConfigure should not return 
EFI_INVALID_PARAMETER.

Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Cc: Zhang Lubo <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <[email protected]>
---
 NetworkPkg/HttpDxe/HttpImpl.c | 9 +++++----  NetworkPkg/HttpDxe/HttpImpl.h | 1 
-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index 7ee6613..12f22db 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -112,11 +112,10 @@ EfiHttpGetModeData (
   @param[in]  HttpConfigData      Pointer to the configure data to configure 
the instance.
 
   @retval EFI_SUCCESS             Operation succeeded.
   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
                                   This is NULL.
-                                  HttpConfigData is NULL.
                                   HttpConfigData->LocalAddressIsIPv6 is FALSE 
and
                                   HttpConfigData->IPv4Node is NULL.
                                   HttpConfigData->LocalAddressIsIPv6 is TRUE 
and
                                   HttpConfigData->IPv6Node is NULL.
   @retval EFI_ALREADY_STARTED     Reinitialize this HTTP instance without 
calling
@@ -139,13 +138,13 @@ EfiHttpConfigure (
   
   //
   // Check input parameters.
   //
   if (This == NULL ||
-      HttpConfigData == NULL ||
-     ((HttpConfigData->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv6Node == NULL) ||
-     (!HttpConfigData->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv4Node == NULL))) {
+      (HttpConfigData != NULL && 
+       ((HttpConfigData->LocalAddressIsIPv6 && 
HttpConfigData->AccessPoint.IPv6Node == NULL) ||
+        (!HttpConfigData->LocalAddressIsIPv6 && 
+ HttpConfigData->AccessPoint.IPv4Node == NULL)))) {
     return EFI_INVALID_PARAMETER;
   }
 
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
   ASSERT (HttpInstance != NULL && HttpInstance->Service != NULL); @@ -252,10 
+251,11 @@ EfiHttpRequest (
   //
   // Initializations
   //
   Url = NULL;
   UrlParser = NULL;
+  RemotePort = 0;
   HostName = NULL;
   RequestMsg = NULL;
   HostNameStr = NULL;
   Wrap = NULL;
   FileUrl = NULL;
@@ -906,10 +906,11 @@ HttpResponseWorker (
   HttpMsg->Headers          = NULL;
   HttpHeaders               = NULL;
   SizeofHeaders             = 0;
   BufferSize                = 0;
   EndofHeader               = NULL;
+  ValueInItem               = NULL;
  
   if (HttpMsg->Data.Response != NULL) {
     //
     // Need receive the HTTP headers, prepare buffer.
     //
diff --git a/NetworkPkg/HttpDxe/HttpImpl.h b/NetworkPkg/HttpDxe/HttpImpl.h 
index 415b5e5..40b2504 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.h
+++ b/NetworkPkg/HttpDxe/HttpImpl.h
@@ -70,11 +70,10 @@ EfiHttpGetModeData (
   @param[in]  HttpConfigData      Pointer to the configure data to configure 
the instance.
 
   @retval EFI_SUCCESS             Operation succeeded.
   @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
                                   This is NULL.
-                                  HttpConfigData is NULL.
                                   HttpConfigData->LocalAddressIsIPv6 is FALSE 
and
                                   HttpConfigData->IPv4Node is NULL.
                                   HttpConfigData->LocalAddressIsIPv6 is TRUE 
and
                                   HttpConfigData->IPv6Node is NULL.
   @retval EFI_ALREADY_STARTED     Reinitialize this HTTP instance without 
calling
--
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to