[edk2-devel] [edk2-libc Patch] StdLib/LibC/Uefi/Devices/Utility: Fix use after free

Michael D Kinney michael.d.kinney at intel.com
Wed Aug 18 23:45:13 UTC 2021


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 at nuviainc.com>
Signed-off-by: Michael D Kinney <michael.d.kinney at 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79543): https://edk2.groups.io/g/devel/message/79543
Mute This Topic: https://groups.io/mt/84985779/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list