[XAM] Fixed potantial crash while upserting setting related to missing SPA

- Fixed OOR asssertion caused by invalid amount of characters read by from_string
This commit is contained in:
Gliniak
2025-12-22 18:47:34 +01:00
parent 169fea978a
commit e786d5c8c3
2 changed files with 7 additions and 4 deletions

View File

@@ -451,15 +451,18 @@ struct GamerPictureKey {
char small_tile_id[8];
uint32_t GetTitleId() const {
return string_util::from_string<uint32_t>(title_id, true);
return string_util::from_string<uint32_t>(
std::string(title_id, std::size(title_id)), true);
}
uint32_t GetBigTileId() const {
return string_util::from_string<uint32_t>(big_tile_id, true);
return string_util::from_string<uint32_t>(
std::string(big_tile_id, std::size(big_tile_id)), true);
}
uint32_t GetSmallTileId() const {
return string_util::from_string<uint32_t>(small_tile_id, true);
return string_util::from_string<uint32_t>(
std::string(small_tile_id, std::size(small_tile_id)), true);
}
};
static_assert_size(GamerPictureKey, 0x18);

View File

@@ -734,7 +734,7 @@ void UserTracker::UpsertSetting(uint64_t xuid, uint32_t title_id,
// Sometimes games like to ignore providing expicitly title_id, so we need to
// check it.
if (!title_id) {
title_id = spa_data_->title_id();
title_id = spa_data_ ? spa_data_->title_id() : kernel_state()->title_id();
}
GpdInfo* info = user->GetGpd(title_id);