@@ -266,7 +266,7 @@ void NetworkServer::StartServer()
266266 for (res = result; res && socket_count < MAXSOCK; res = res->ai_next )
267267 {
268268 server_sock[socket_count] = socket (res->ai_family , res->ai_socktype , res->ai_protocol );
269-
269+
270270 if (server_sock[socket_count] == INVALID_SOCKET)
271271 {
272272 printf (" Error: network socket could not be created\n " );
@@ -320,7 +320,7 @@ void NetworkServer::StartServer()
320320
321321 freeaddrinfo (result);
322322 server_online = true ;
323-
323+
324324 /* -------------------------------------------------*\
325325 | Start the connection thread |
326326 \*-------------------------------------------------*/
@@ -430,7 +430,7 @@ void NetworkServer::ConnectionThreadFunction(int socket_idx)
430430 socklen_t len;
431431 len = sizeof (tmp_addr);
432432 getpeername (client_info->client_sock , (struct sockaddr *)&tmp_addr, &len);
433-
433+
434434 if (tmp_addr.ss_family == AF_INET)
435435 {
436436 struct sockaddr_in *s_4 = (struct sockaddr_in *)&tmp_addr;
@@ -780,7 +780,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
780780
781781 if (profile_manager)
782782 {
783- profile_manager->SaveProfile (data);
783+ std::string profile_name;
784+ profile_name.assign (data, header.pkt_size );
785+
786+ profile_manager->SaveProfile (profile_name);
784787 }
785788
786789 break ;
@@ -793,7 +796,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
793796
794797 if (profile_manager)
795798 {
796- profile_manager->LoadProfile (data);
799+ std::string profile_name;
800+ profile_name.assign (data, header.pkt_size );
801+
802+ profile_manager->LoadProfile (profile_name);
797803 }
798804
799805 for (RGBController* controller : controllers)
@@ -811,7 +817,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
811817
812818 if (profile_manager)
813819 {
814- profile_manager->DeleteProfile (data);
820+ std::string profile_name;
821+ profile_name.assign (data, header.pkt_size );
822+
823+ profile_manager->DeleteProfile (profile_name);
815824 }
816825
817826 break ;
@@ -897,14 +906,14 @@ void NetworkServer::ProcessRequest_ClientProtocolVersion(SOCKET client_sock, uns
897906 ClientInfoChanged ();
898907}
899908
900- void NetworkServer::ProcessRequest_ClientString (SOCKET client_sock, unsigned int /* data_size*/ , char * data)
909+ void NetworkServer::ProcessRequest_ClientString (SOCKET client_sock, unsigned int data_size, char * data)
901910{
902911 ServerClientsMutex.lock ();
903912 for (unsigned int this_idx = 0 ; this_idx < ServerClients.size (); this_idx++)
904913 {
905914 if (ServerClients[this_idx]->client_sock == client_sock)
906915 {
907- ServerClients[this_idx]->client_string = data;
916+ ServerClients[this_idx]->client_string . assign ( data, data_size) ;
908917 break ;
909918 }
910919 }
@@ -1028,7 +1037,7 @@ void NetworkServer::SendReply_PluginList(SOCKET client_sock)
10281037{
10291038 unsigned int data_size = 0 ;
10301039 unsigned int data_ptr = 0 ;
1031-
1040+
10321041 /* ---------------------------------------------------------*\
10331042 | Calculate data size |
10341043 \*---------------------------------------------------------*/
@@ -1045,12 +1054,12 @@ void NetworkServer::SendReply_PluginList(SOCKET client_sock)
10451054 data_size += strlen (plugins[i].version .c_str ()) + 1 ;
10461055 data_size += sizeof (unsigned int ) * 2 ;
10471056 }
1048-
1057+
10491058 /* ---------------------------------------------------------*\
10501059 | Create data buffer |
10511060 \*---------------------------------------------------------*/
10521061 unsigned char *data_buf = new unsigned char [data_size];
1053-
1062+
10541063 /* ---------------------------------------------------------*\
10551064 | Copy in data size |
10561065 \*---------------------------------------------------------*/
@@ -1103,14 +1112,14 @@ void NetworkServer::SendReply_PluginList(SOCKET client_sock)
11031112 \*---------------------------------------------------------*/
11041113 memcpy (&data_buf[data_ptr], &i, sizeof (unsigned int ));
11051114 data_ptr += sizeof (unsigned int );
1106-
1115+
11071116 /* ---------------------------------------------------------*\
11081117 | Copy in plugin sdk version (data) |
11091118 \*---------------------------------------------------------*/
11101119 memcpy (&data_buf[data_ptr], &plugins[i].protocol_version , sizeof (int ));
11111120 data_ptr += sizeof (int );
11121121 }
1113-
1122+
11141123 NetPacketHeader reply_hdr;
11151124 unsigned int reply_size;
11161125
0 commit comments