From 357ff8a2c55900a3db99888a563443c4f69b2941 Mon Sep 17 00:00:00 2001 From: Johan Mattsson <39247600+mjunix@users.noreply.github.com> Date: Sun, 6 Aug 2023 00:20:22 +0200 Subject: [PATCH 1/2] Fix potential index out of bounds --- desmume/src/slot2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desmume/src/slot2.cpp b/desmume/src/slot2.cpp index 8dd6ce993..7463d3e23 100644 --- a/desmume/src/slot2.cpp +++ b/desmume/src/slot2.cpp @@ -163,7 +163,7 @@ bool slot2_Change(NDS_SLOT2_TYPE changeToType) void slot2_setDeviceByType(NDS_SLOT2_TYPE theType) { - if (theType > NDS_SLOT2_COUNT || theType < 0) + if (theType >= NDS_SLOT2_COUNT || theType < 0) { return; } From ca799e60b7a1cdcc8479c34e0565ead7430a4b6a Mon Sep 17 00:00:00 2001 From: Johan Mattsson <39247600+mjunix@users.noreply.github.com> Date: Sun, 6 Aug 2023 00:35:40 +0200 Subject: [PATCH 2/2] Fix potential index out of bounds --- desmume/src/slot2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desmume/src/slot2.cpp b/desmume/src/slot2.cpp index 7463d3e23..4640b5a0b 100644 --- a/desmume/src/slot2.cpp +++ b/desmume/src/slot2.cpp @@ -106,7 +106,7 @@ void slot2_Reset() bool slot2_Change(NDS_SLOT2_TYPE changeToType) { - if (changeToType > NDS_SLOT2_COUNT || changeToType < 0) + if (changeToType >= NDS_SLOT2_COUNT || changeToType < 0) return false; if (slot2_device_type == changeToType)