public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Mike Maslenkin" <mike.maslenkin@gmail.com>
To: devel@edk2.groups.io
Cc: abner.chang@amd.com, nicklew@nvidia.com, igork@ami.com,
	Mike Maslenkin <mike.maslenkin@gmail.com>
Subject: [edk2-devel] [PATCH 2/5] RedfishClientPkg: fix access to uninitialized variable
Date: Sun, 27 Aug 2023 13:56:37 +0300	[thread overview]
Message-ID: <20230827105640.94731-3-mike.maslenkin@gmail.com> (raw)
In-Reply-To: <20230827105640.94731-1-mike.maslenkin@gmail.com>

This patch fixes access to uninitialized variable, causing ASSERT from
FreePool at least.

Before this patch RedfishSettingsResponse was initialized by
GetResourceByUri under 'if (JsonValue != NULL)' condition.
But freed under 'if (Private->Payload != NULL)' condition.
Thus uninitialized pointers caused ASSERT on attempt to free memory.

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
index e7ac8779581c..f5562fb49cab 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
@@ -128,6 +128,8 @@ RedfishResourceConsumeResource (
     return Status;
   }
 
+  ZeroMem (&RedfishSettingsResponse, sizeof (REDFISH_RESPONSE));
+
   ExpectedResponse   = &Response;
   RedfishSettingsUri = NULL;
   JsonValue          = RedfishJsonInPayload (Response.Payload);
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108045): https://edk2.groups.io/g/devel/message/108045
Mute This Topic: https://groups.io/mt/100988472/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2023-08-27 10:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-27 10:56 [edk2-devel] [PATCH 0/5] RedfishClientPkg: fix issues with local variables Mike Maslenkin
2023-08-27 10:56 ` [edk2-devel] [PATCH 1/5] RedfishClientPkg: fix crash on access to uninialized list variable Mike Maslenkin
2023-08-27 10:56 ` Mike Maslenkin [this message]
2023-08-27 10:56 ` [edk2-devel] [PATCH 3/5] RedfishClientPkg: fix leak of allocated Etag data Mike Maslenkin
2023-08-27 10:56 ` [edk2-devel] [PATCH 4/5] RedfishClientPkg: fix memory leak during EFI variables write Mike Maslenkin
2023-08-27 10:56 ` [edk2-devel] [PATCH 5/5] RedfishClientPkg: fix misprints in Readme.md Mike Maslenkin
2023-08-28  9:03 ` [edk2-devel] [PATCH 0/5] RedfishClientPkg: fix issues with local variables Nickle Wang via groups.io
2023-08-28 23:18   ` Mike Maslenkin
2023-08-29  7:45     ` Nickle Wang via groups.io

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230827105640.94731-3-mike.maslenkin@gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox