Christopher,

I think the current code is ok, because before use ConfigResp, we has set it to 
NULL, and the ConfigResp will be used to save the return value only when the 
return status is success, otherwise this parameter should keep as NULL.

What do you think? Do you met any issue already?

Thanks,
Eric
From: [email protected] [mailto:[email protected]]
Sent: Thursday, May 01, 2014 1:56 AM
To: [email protected]
Subject: [edk2] [PATCH] MdeModulePkg: Potential invalid free in HiiLib


Dear MdeModulePkg maintainer,

I would like to submit this patch. Do I just post it to this list?

Thank you for your time.
==============================================
MdeModulePkg: Fix potential invalid free in HiiLib

This relates to a previous call to gHiiConfigRouting->GetAltConfig.
The only guarantee the UEFI specification makes about the state of
ConfigResp is that it will be allocated if the function returns
EFI_SUCCESS. Since there is no guarantee that ConfigResp will remain
NULL if GetAltConfig fails, ConfigResp should be reset to NULL so
that the cleanup code for this function does not attempt to call
FreePool() on a potentially invalid pointer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chris Barr 
<[email protected]<mailto:[email protected]>>
---
 MdeModulePkg/Library/UefiHiiLib/HiiLib.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c 
b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
index 09f1ff7..cfadbdb 100644
--- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
+++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
@@ -2156,6 +2156,7 @@ InternalHiiIfrValueAction (
     // The required setting can't be found. So, it is not required to be 
validated and set.
     //
     if (EFI_ERROR (Status)) {
+      ConfigResp = NULL;
       Status = EFI_SUCCESS;
       goto NextConfigAltResp;
     }
------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to