public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@nuviainc.com>
Subject: [edk2-libc Patch] StdLib/LibC/Uefi/Devices/Utility: Fix use after free
Date: Wed, 18 Aug 2021 16:45:13 -0700	[thread overview]
Message-ID: <20210818234513.571-1-michael.d.kinney@intel.com> (raw)

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=38

Set MPath to NULL after free(MPath) to guarantee that MPath
is not used after the free() call.

Cc: Rebecca Cran <rebecca@nuviainc.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 StdLib/LibC/Uefi/Devices/Utility/Path.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/StdLib/LibC/Uefi/Devices/Utility/Path.c b/StdLib/LibC/Uefi/Devices/Utility/Path.c
index d6728d3..fe19196 100644
--- a/StdLib/LibC/Uefi/Devices/Utility/Path.c
+++ b/StdLib/LibC/Uefi/Devices/Utility/Path.c
@@ -359,6 +359,7 @@ reclassify:
     }
     else if(MPath != NULL) {
       free(MPath);    /* Caller doesn't want it so let MPath go free */
+      MPath = NULL;
     }
 
     /*  At this point, WPath is an absolute path,
-- 
2.32.0.windows.1


             reply	other threads:[~2021-08-18 23:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18 23:45 Michael D Kinney [this message]
2021-08-19  1:45 ` [edk2-libc Patch] StdLib/LibC/Uefi/Devices/Utility: Fix use after free Rebecca Cran

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=20210818234513.571-1-michael.d.kinney@intel.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