[glass] FMS: Fix reading past end of GSM buffer (#8268)

This commit is contained in:
Peter Johnson
2025-10-02 17:35:50 -07:00
committed by GitHub
parent 5e7e5306df
commit ca7718cb08

View File

@@ -148,11 +148,14 @@ void glass::DisplayFMSReadOnly(FMSModel* model) {
ImGui::TextUnformatted("?");
}
}
wpi::SmallString<64> gameSpecificMessageBuf;
std::string_view gameSpecificMessage =
model->GetGameSpecificMessage(gameSpecificMessageBuf);
ImGui::Text("Game Specific: %s", exists ? gameSpecificMessage.data() : "?");
if (exists) {
wpi::SmallString<64> gsmBuf;
std::string_view gsm = model->GetGameSpecificMessage(gsmBuf);
ImGui::Text("Game Specific: %.*s", static_cast<int>(gsm.size()),
gsm.data());
} else {
ImGui::TextUnformatted("Game Specific: ?");
}
if (!exists) {
ImGui::PopStyleColor();