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

Rebecca Cran rebecca at nuviainc.com
Thu Aug 19 01:45:04 UTC 2021


Reviewed-by: Rebecca Cran <rebecca at nuviainc.com>


-- 
Rebecca Cran

On 8/18/21 5:45 PM, Michael D Kinney wrote:
> 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,


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79547): https://edk2.groups.io/g/devel/message/79547
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