forked from ShuriZma/suyu
1
0
Fork 0

mii_types: Remove null terminator check

This is an OoB array access, causing a crash on at least the Linux
Flatpak releases.

Co-authored-by: german77 <juangerman-13@hotmail.com>
This commit is contained in:
lat9nq 2023-09-17 15:23:57 -04:00
parent 2fe92436b9
commit 77682aabd3
1 changed files with 1 additions and 4 deletions

View File

@ -606,15 +606,12 @@ struct Nickname {
static constexpr std::size_t MaxNameSize = 10; static constexpr std::size_t MaxNameSize = 10;
std::array<char16_t, MaxNameSize> data; std::array<char16_t, MaxNameSize> data;
// Checks for null, non-zero terminated or dirty strings // Checks for null or dirty strings
bool IsValid() const { bool IsValid() const {
if (data[0] == 0) { if (data[0] == 0) {
return false; return false;
} }
if (data[MaxNameSize] != 0) {
return false;
}
std::size_t index = 1; std::size_t index = 1;
while (data[index] != 0) { while (data[index] != 0) {
index++; index++;