[edk2-devel] [PATCH] MdeModulePkg/Application: Overflowed Array Index

GuoMinJ posted 1 patch 4 years, 2 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
.../Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c   | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2-devel] [PATCH] MdeModulePkg/Application: Overflowed Array Index
Posted by GuoMinJ 4 years, 2 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2272

Index should be off-by one than size of array, so when check
mUsbTypeString, the max index should less than size of array.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
---
 .../Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
index 0f7163160b..f8afcd6f96 100644
--- a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
+++ b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
@@ -508,7 +508,7 @@ UsbTypeToString (
   IN EFI_USB_SMI_TYPE          Type
   )
 {
-  if (Type >= 0 && Type <= ARRAY_SIZE(mUsbTypeString)) {
+  if (Type >= 0 && Type < ARRAY_SIZE(mUsbTypeString)) {
     return mUsbTypeString[Type];
   } else {
     AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
-- 
2.17.1


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

View/Reply Online (#54668): https://edk2.groups.io/g/devel/message/54668
Mute This Topic: https://groups.io/mt/71423321/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-