[edk2-devel] [PATCH EDK2 v1 1/1] MdePkg/DxeHstiLib: avoid Hsti offset overflow
wenyi,xie via groups.io
xiewenyi2=huawei.com at groups.io
Thu Nov 19 09:27:18 UTC 2020
add conditional operator to check whether the HstiSize is larger than
sizeof(CHAR16). If not, setting offset to 0 to avoid overflow.
Cc: Michael D Kinney <michael.d.kinney at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu at intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2 at huawei.com>
---
MdePkg/Library/DxeHstiLib/HstiDxe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MdePkg/Library/DxeHstiLib/HstiDxe.c b/MdePkg/Library/DxeHstiLib/HstiDxe.c
index 4e1c67616b01..f04e6f13b7e5 100644
--- a/MdePkg/Library/DxeHstiLib/HstiDxe.c
+++ b/MdePkg/Library/DxeHstiLib/HstiDxe.c
@@ -519,7 +519,7 @@ InternalHstiRecordErrorString (
}
if (Append) {
- Offset = HstiSize - sizeof(CHAR16);
+ Offset = (HstiSize >= sizeof(CHAR16)) ? (HstiSize - sizeof(CHAR16)) : 0;
} else {
Offset = sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3;
}
--
2.20.1.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67697): https://edk2.groups.io/g/devel/message/67697
Mute This Topic: https://groups.io/mt/78361269/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