fix unhandled out of bounds in Authentication

This commit is contained in:
Lion Kortlepel
2022-11-10 18:50:58 +01:00
parent 3fcf23977b
commit 79ee5915b4

View File

@@ -277,7 +277,11 @@ std::shared_ptr<TClient> TNetwork::Authentication(TConnection&& RawConnection) {
for (const auto& ID : AuthRes["identifiers"]) {
auto Raw = std::string(ID);
auto SepIndex = Raw.find(':');
Client->SetIdentifier(Raw.substr(0, SepIndex), Raw.substr(SepIndex + 1));
if (SepIndex != std::string::npos) {
Client->SetIdentifier(Raw.substr(0, SepIndex), Raw.substr(SepIndex + 1));
} else {
beammp_errorf("Invalid response from auth servers: No ':' in identifier '{}', ignoring it", Raw);
}
}
} else {
beammp_error("Invalid authentication data received from authentication backend");