From 79ee5915b458e31e9582061bf0a5d67de8931672 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 10 Nov 2022 18:50:58 +0100 Subject: [PATCH] fix unhandled out of bounds in Authentication --- src/TNetwork.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/TNetwork.cpp b/src/TNetwork.cpp index 3b4d9df..593f62b 100644 --- a/src/TNetwork.cpp +++ b/src/TNetwork.cpp @@ -277,7 +277,11 @@ std::shared_ptr 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");