The returned value from GetBufferForValue might be NULL, so add a
check for that before it is used.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Signed-off-by: Shenglei Zhang <[email protected]>
---
 MdeModulePkg/Universal/SetupBrowserDxe/Expression.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
index 7f4929c2fcd9..984c68c6bb7a 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
@@ -1281,7 +1281,12 @@ IfrToUint (
       Result->Type = EFI_IFR_TYPE_UNDEFINED;
       return EFI_SUCCESS;
     }
+
+    if (GetBufferForValue (&Value) == NULL) {
+      return EFI_NOT_FOUND;
+    }
     Result->Value.u64 = *(UINT64*) GetBufferForValue (&Value);
+
     if (Value.Type == EFI_IFR_TYPE_BUFFER) {
       FreePool (Value.Buffer);
     }
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49148): https://edk2.groups.io/g/devel/message/49148
Mute This Topic: https://groups.io/mt/34668867/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to