1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Merge pull request #3696 from 678098/fix_port_int16_t_overflow

Fix: prevent possible int16_t overflow
This commit is contained in:
Ivan Savenko 2024-03-29 10:48:21 +02:00 committed by GitHub
commit 5d8432bd24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -289,7 +289,7 @@ void GlobalLobbyClient::receiveJoinRoomSuccess(const JsonNode & json)
CSH->loadMode = ELoadMode::MULTI;
std::string hostname = settings["lobby"]["hostname"].String();
int16_t port = settings["lobby"]["port"].Integer();
uint16_t port = settings["lobby"]["port"].Integer();
CSH->connectToServer(hostname, port);
}
@ -379,7 +379,7 @@ void GlobalLobbyClient::sendOpenRoom(const std::string & mode, int playerLimit)
void GlobalLobbyClient::connect()
{
std::string hostname = settings["lobby"]["hostname"].String();
int16_t port = settings["lobby"]["port"].Integer();
uint16_t port = settings["lobby"]["port"].Integer();
CSH->getNetworkHandler().connectToRemote(*this, hostname, port);
}

View File

@ -24,7 +24,7 @@ GlobalLobbyProcessor::GlobalLobbyProcessor(CVCMIServer & owner)
void GlobalLobbyProcessor::establishNewConnection()
{
std::string hostname = settings["lobby"]["hostname"].String();
int16_t port = settings["lobby"]["port"].Integer();
uint16_t port = settings["lobby"]["port"].Integer();
owner.getNetworkHandler().connectToRemote(*this, hostname, port);
}