This patch enhances the NULL pointer check of the HttpInstance->RemoteHost
pointer before dereference it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <[email protected]>
---
 NetworkPkg/HttpDxe/HttpImpl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 76c95b2..50c0617 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -316,7 +316,7 @@ EfiHttpRequest (
   Configure   = TRUE;
   ReConfigure = TRUE;  
 
-  if (HttpInstance->RemoteHost == NULL && HttpInstance->RemotePort == 0) {
+  if (HttpInstance->RemoteHost == NULL) {
     //
     // Request() is called the first time. 
     //
@@ -373,6 +373,7 @@ EfiHttpRequest (
       if (HttpInstance->RemoteHost != NULL) {
         FreePool (HttpInstance->RemoteHost);
         HttpInstance->RemoteHost = NULL;
+        HttpInstance->RemotePort = 0;
       }
     }
   } 
-- 
2.5.0.windows.1

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

Reply via email to