Use size when parsing received buffers into strings in NetworkServer
This commit is contained in:
parent
af53230244
commit
d7ed55b264
1 changed files with 22 additions and 13 deletions
|
|
@ -780,7 +780,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
|||
|
||||
if(profile_manager)
|
||||
{
|
||||
profile_manager->SaveProfile(data);
|
||||
std::string profile_name;
|
||||
profile_name.assign(data, header.pkt_size);
|
||||
|
||||
profile_manager->SaveProfile(profile_name);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -793,7 +796,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
|||
|
||||
if(profile_manager)
|
||||
{
|
||||
profile_manager->LoadProfile(data);
|
||||
std::string profile_name;
|
||||
profile_name.assign(data, header.pkt_size);
|
||||
|
||||
profile_manager->LoadProfile(profile_name);
|
||||
}
|
||||
|
||||
for(RGBController* controller : controllers)
|
||||
|
|
@ -811,7 +817,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
|||
|
||||
if(profile_manager)
|
||||
{
|
||||
profile_manager->DeleteProfile(data);
|
||||
std::string profile_name;
|
||||
profile_name.assign(data, header.pkt_size);
|
||||
|
||||
profile_manager->DeleteProfile(profile_name);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -897,14 +906,14 @@ void NetworkServer::ProcessRequest_ClientProtocolVersion(SOCKET client_sock, uns
|
|||
ClientInfoChanged();
|
||||
}
|
||||
|
||||
void NetworkServer::ProcessRequest_ClientString(SOCKET client_sock, unsigned int /*data_size*/, char * data)
|
||||
void NetworkServer::ProcessRequest_ClientString(SOCKET client_sock, unsigned int data_size, char * data)
|
||||
{
|
||||
ServerClientsMutex.lock();
|
||||
for(unsigned int this_idx = 0; this_idx < ServerClients.size(); this_idx++)
|
||||
{
|
||||
if(ServerClients[this_idx]->client_sock == client_sock)
|
||||
{
|
||||
ServerClients[this_idx]->client_string = data;
|
||||
ServerClients[this_idx]->client_string.assign(data, data_size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue