mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 23:24:03 +02:00
MdeModulePkg/SmiHandlerProfileInfo: Overflowed Array Index
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2272 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2287 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2288 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2289 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2290 Index should be off-by one than size of array, so when check array, the max index should less than size of array. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Guomin Jiang <guomin.jiang@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
parent
3ab0dadd66
commit
d6f99b2ac4
@ -382,7 +382,7 @@ SxTypeToString (
|
|||||||
IN EFI_SLEEP_TYPE Type
|
IN EFI_SLEEP_TYPE Type
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Type >= 0 && Type <= ARRAY_SIZE(mSxTypeString)) {
|
if (Type >= 0 && Type < ARRAY_SIZE(mSxTypeString)) {
|
||||||
return mSxTypeString[Type];
|
return mSxTypeString[Type];
|
||||||
} else {
|
} else {
|
||||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
|
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
|
||||||
@ -407,7 +407,7 @@ SxPhaseToString (
|
|||||||
IN EFI_SLEEP_PHASE Phase
|
IN EFI_SLEEP_PHASE Phase
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Phase >= 0 && Phase <= ARRAY_SIZE(mSxPhaseString)) {
|
if (Phase >= 0 && Phase < ARRAY_SIZE(mSxPhaseString)) {
|
||||||
return mSxPhaseString[Phase];
|
return mSxPhaseString[Phase];
|
||||||
} else {
|
} else {
|
||||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
|
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
|
||||||
@ -432,7 +432,7 @@ PowerButtonPhaseToString (
|
|||||||
IN EFI_POWER_BUTTON_PHASE Phase
|
IN EFI_POWER_BUTTON_PHASE Phase
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Phase >= 0 && Phase <= ARRAY_SIZE(mPowerButtonPhaseString)) {
|
if (Phase >= 0 && Phase < ARRAY_SIZE(mPowerButtonPhaseString)) {
|
||||||
return mPowerButtonPhaseString[Phase];
|
return mPowerButtonPhaseString[Phase];
|
||||||
} else {
|
} else {
|
||||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
|
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
|
||||||
@ -457,7 +457,7 @@ StandbyButtonPhaseToString (
|
|||||||
IN EFI_STANDBY_BUTTON_PHASE Phase
|
IN EFI_STANDBY_BUTTON_PHASE Phase
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Phase >= 0 && Phase <= ARRAY_SIZE(mStandbyButtonPhaseString)) {
|
if (Phase >= 0 && Phase < ARRAY_SIZE(mStandbyButtonPhaseString)) {
|
||||||
return mStandbyButtonPhaseString[Phase];
|
return mStandbyButtonPhaseString[Phase];
|
||||||
} else {
|
} else {
|
||||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
|
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Phase);
|
||||||
@ -483,7 +483,7 @@ IoTrapTypeToString (
|
|||||||
IN EFI_SMM_IO_TRAP_DISPATCH_TYPE Type
|
IN EFI_SMM_IO_TRAP_DISPATCH_TYPE Type
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Type >= 0 && Type <= ARRAY_SIZE(mIoTrapTypeString)) {
|
if (Type >= 0 && Type < ARRAY_SIZE(mIoTrapTypeString)) {
|
||||||
return mIoTrapTypeString[Type];
|
return mIoTrapTypeString[Type];
|
||||||
} else {
|
} else {
|
||||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
|
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
|
||||||
@ -508,7 +508,7 @@ UsbTypeToString (
|
|||||||
IN EFI_USB_SMI_TYPE Type
|
IN EFI_USB_SMI_TYPE Type
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Type >= 0 && Type <= ARRAY_SIZE(mUsbTypeString)) {
|
if (Type >= 0 && Type < ARRAY_SIZE(mUsbTypeString)) {
|
||||||
return mUsbTypeString[Type];
|
return mUsbTypeString[Type];
|
||||||
} else {
|
} else {
|
||||||
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
|
AsciiSPrint (mNameString, sizeof(mNameString), "0x%x", Type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user