This patch is used to fix suspicious dereference of pointer 'FieldCount'
before NULL check.

Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <[email protected]>
---
 NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c 
b/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c
index 8c29f20..a83c963 100644
--- a/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c
+++ b/NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesProtocol.c
@@ -305,11 +305,10 @@ HttpUtilitiesParse (
   CHAR8                     *FieldValue;
   UINTN                     Index;
   
   Status          = EFI_SUCCESS;
   TempHttpMessage = NULL;
-  *FieldCount     = 0;
   Token           = NULL;
   NextToken       = NULL;
   FieldName       = NULL;
   FieldValue      = NULL;
   Index           = 0;
@@ -326,10 +325,11 @@ HttpUtilitiesParse (
   CopyMem (TempHttpMessage, HttpMessage, HttpMessageSize);
   
   //
   // Get header number
   //
+  *FieldCount = 0;
   Token = TempHttpMessage;
   while (TRUE) {
     FieldName     = NULL;
     FieldValue    = NULL;
     NextToken = GetFieldNameAndValue (Token, &FieldName, &FieldValue);
-- 
1.9.5.msysgit.1

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

Reply via email to