diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp index c23d1c9c0..627c56bdd 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp @@ -1025,13 +1025,16 @@ namespace ams::dmnt::cheat::impl { /* Skip whitespace. */ while (std::isspace(static_cast(s[i]))) { i++; + if (i >= len) { + return false; + } } /* Parse whether to toggle. */ j = i + 1; - while (!std::isspace(static_cast(s[j]))) { + while (j < len && !std::isspace(static_cast(s[j]))) { j++; - if (j >= len || (j - i) >= sizeof(toggle)) { + if ((j - i) >= sizeof(toggle)) { return false; } }