[edk2-devel] [PATCH v2 4/4] MdeModulePkg/SetupBrowserDxe: Add check for GetBufferForValue()
Dandan Bi
dandan.bi at intel.com
Thu Oct 31 02:01:09 UTC 2019
-----Original Message-----
From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Zhang, Shenglei
Sent: Wednesday, October 30, 2019 10:27 PM
To: devel at edk2.groups.io
Cc: Wang, Jian J <jian.j.wang at intel.com>; Wu, Hao A <hao.a.wu at intel.com>
Subject: [edk2-devel] [PATCH v2 4/4] MdeModulePkg/SetupBrowserDxe: Add check for GetBufferForValue()
The returned value from GetBufferForValue might be NULL, so add a check for that before it is used.
Cc: Jian J Wang <jian.j.wang at intel.com>
Cc: Hao A Wu <hao.a.wu at intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang at intel.com>
---
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;
+ }
Hi Shenglei,
Before call GetBufferForValue function, has already called function IsTypeInBuffer to make sure the value must be buffer type.
So GetBufferForValue can not return NULL.
I think we also can add ASSERT here.
Thanks,
Dandan
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 (#49708): https://edk2.groups.io/g/devel/message/49708
Mute This Topic: https://groups.io/mt/39808369/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