dmnt: allow string termination to end a toggle (closes #1980)

This commit is contained in:
Michael Scire 2022-10-28 14:14:38 -07:00
parent e3ace4be15
commit ff7a80e592

View file

@ -1025,13 +1025,16 @@ namespace ams::dmnt::cheat::impl {
/* Skip whitespace. */ /* Skip whitespace. */
while (std::isspace(static_cast<unsigned char>(s[i]))) { while (std::isspace(static_cast<unsigned char>(s[i]))) {
i++; i++;
if (i >= len) {
return false;
}
} }
/* Parse whether to toggle. */ /* Parse whether to toggle. */
j = i + 1; j = i + 1;
while (!std::isspace(static_cast<unsigned char>(s[j]))) { while (j < len && !std::isspace(static_cast<unsigned char>(s[j]))) {
j++; j++;
if (j >= len || (j - i) >= sizeof(toggle)) { if ((j - i) >= sizeof(toggle)) {
return false; return false;
} }
} }