mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-04 06:46:23 +00:00
fix potential out of bounds exception in GetPidVid
This commit is contained in:
@@ -25,6 +25,10 @@ struct VehiclePacket {
|
||||
|
||||
static std::optional<std::pair<int, int>> GetPidVid(const std::string& str) {
|
||||
auto IDSep = str.find('-');
|
||||
if (IDSep == std::string::npos) {
|
||||
beammp_debugf("Invalid packet: Could not parse pid/vid from packet, as there is no '-' separator: '{}'", str);
|
||||
return std::nullopt;
|
||||
}
|
||||
std::string pid = str.substr(0, IDSep);
|
||||
std::string vid = str.substr(IDSep + 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user