NetworkPkg: Enhance the NULL pointer check before dereference it.
authorFu Siyuan <siyuan.fu@intel.com>
Wed, 16 Sep 2015 08:52:24 +0000 (08:52 +0000)
committersfu5 <sfu5@Edk2>
Wed, 16 Sep 2015 08:52:24 +0000 (08:52 +0000)
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 <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18482 6f19259b-4bc3-4df7-8a09-765794883524

NetworkPkg/HttpDxe/HttpImpl.c

index 76c95b2bb66a3be299c56a321770168493ec939e..50c061743665b4c1511b5a849dca76dca0833029 100644 (file)
@@ -316,7 +316,7 @@ EfiHttpRequest (
   Configure   = TRUE;\r
   ReConfigure = TRUE;  \r
 \r
-  if (HttpInstance->RemoteHost == NULL && HttpInstance->RemotePort == 0) {\r
+  if (HttpInstance->RemoteHost == NULL) {\r
     //\r
     // Request() is called the first time. \r
     //\r
@@ -373,6 +373,7 @@ EfiHttpRequest (
       if (HttpInstance->RemoteHost != NULL) {\r
         FreePool (HttpInstance->RemoteHost);\r
         HttpInstance->RemoteHost = NULL;\r
+        HttpInstance->RemotePort = 0;\r
       }\r
     }\r
   } \r