Merge pull request #720 from mjunix/master-1

Fix potential index out of bounds
This commit is contained in:
zeromus 2023-08-05 15:46:28 -07:00 committed by GitHub
commit 3955480674
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -106,7 +106,7 @@ void slot2_Reset()
bool slot2_Change(NDS_SLOT2_TYPE changeToType) bool slot2_Change(NDS_SLOT2_TYPE changeToType)
{ {
if (changeToType > NDS_SLOT2_COUNT || changeToType < 0) if (changeToType >= NDS_SLOT2_COUNT || changeToType < 0)
return false; return false;
if (slot2_device_type == changeToType) if (slot2_device_type == changeToType)
@ -163,7 +163,7 @@ bool slot2_Change(NDS_SLOT2_TYPE changeToType)
void slot2_setDeviceByType(NDS_SLOT2_TYPE theType) void slot2_setDeviceByType(NDS_SLOT2_TYPE theType)
{ {
if (theType > NDS_SLOT2_COUNT || theType < 0) if (theType >= NDS_SLOT2_COUNT || theType < 0)
{ {
return; return;
} }