[XAM] Fixed potential use-after-free on profile login

This commit is contained in:
Adrian
2026-03-21 12:22:49 +00:00
committed by Radosław Gliński
parent 9a06a19eac
commit 022a29fe58

View File

@@ -278,10 +278,11 @@ void ProfileManager::Login(const uint64_t xuid, const uint8_t user_index,
}
// Find if xuid is already logged in. We might want to logout.
for (auto& logged_profile : logged_profiles_) {
if (logged_profile.second->xuid() == xuid) {
Logout(logged_profile.first);
}
auto it = std::find_if(
logged_profiles_.begin(), logged_profiles_.end(),
[xuid](const auto& entry) { return entry.second->xuid() == xuid; });
if (it != logged_profiles_.end()) {
Logout(it->first);
}
if (!accounts_.count(xuid)) {