@@ -266,7 +266,7 @@ void NetworkServer::StartServer()
266
266
for (res = result; res && socket_count < MAXSOCK; res = res->ai_next )
267
267
{
268
268
server_sock[socket_count] = socket (res->ai_family , res->ai_socktype , res->ai_protocol );
269
-
269
+
270
270
if (server_sock[socket_count] == INVALID_SOCKET)
271
271
{
272
272
printf (" Error: network socket could not be created\n " );
@@ -320,7 +320,7 @@ void NetworkServer::StartServer()
320
320
321
321
freeaddrinfo (result);
322
322
server_online = true ;
323
-
323
+
324
324
/* -------------------------------------------------*\
325
325
| Start the connection thread |
326
326
\*-------------------------------------------------*/
@@ -430,7 +430,7 @@ void NetworkServer::ConnectionThreadFunction(int socket_idx)
430
430
socklen_t len;
431
431
len = sizeof (tmp_addr);
432
432
getpeername (client_info->client_sock , (struct sockaddr *)&tmp_addr, &len);
433
-
433
+
434
434
if (tmp_addr.ss_family == AF_INET)
435
435
{
436
436
struct sockaddr_in *s_4 = (struct sockaddr_in *)&tmp_addr;
@@ -780,7 +780,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
780
780
781
781
if (profile_manager)
782
782
{
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);
784
787
}
785
788
786
789
break ;
@@ -793,7 +796,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
793
796
794
797
if (profile_manager)
795
798
{
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);
797
803
}
798
804
799
805
for (RGBController* controller : controllers)
@@ -811,7 +817,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
811
817
812
818
if (profile_manager)
813
819
{
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);
815
824
}
816
825
817
826
break ;
@@ -897,14 +906,14 @@ void NetworkServer::ProcessRequest_ClientProtocolVersion(SOCKET client_sock, uns
897
906
ClientInfoChanged ();
898
907
}
899
908
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)
901
910
{
902
911
ServerClientsMutex.lock ();
903
912
for (unsigned int this_idx = 0 ; this_idx < ServerClients.size (); this_idx++)
904
913
{
905
914
if (ServerClients[this_idx]->client_sock == client_sock)
906
915
{
907
- ServerClients[this_idx]->client_string = data;
916
+ ServerClients[this_idx]->client_string . assign ( data, data_size) ;
908
917
break ;
909
918
}
910
919
}
@@ -1028,7 +1037,7 @@ void NetworkServer::SendReply_PluginList(SOCKET client_sock)
1028
1037
{
1029
1038
unsigned int data_size = 0 ;
1030
1039
unsigned int data_ptr = 0 ;
1031
-
1040
+
1032
1041
/* ---------------------------------------------------------*\
1033
1042
| Calculate data size |
1034
1043
\*---------------------------------------------------------*/
@@ -1045,12 +1054,12 @@ void NetworkServer::SendReply_PluginList(SOCKET client_sock)
1045
1054
data_size += strlen (plugins[i].version .c_str ()) + 1 ;
1046
1055
data_size += sizeof (unsigned int ) * 2 ;
1047
1056
}
1048
-
1057
+
1049
1058
/* ---------------------------------------------------------*\
1050
1059
| Create data buffer |
1051
1060
\*---------------------------------------------------------*/
1052
1061
unsigned char *data_buf = new unsigned char [data_size];
1053
-
1062
+
1054
1063
/* ---------------------------------------------------------*\
1055
1064
| Copy in data size |
1056
1065
\*---------------------------------------------------------*/
@@ -1103,14 +1112,14 @@ void NetworkServer::SendReply_PluginList(SOCKET client_sock)
1103
1112
\*---------------------------------------------------------*/
1104
1113
memcpy (&data_buf[data_ptr], &i, sizeof (unsigned int ));
1105
1114
data_ptr += sizeof (unsigned int );
1106
-
1115
+
1107
1116
/* ---------------------------------------------------------*\
1108
1117
| Copy in plugin sdk version (data) |
1109
1118
\*---------------------------------------------------------*/
1110
1119
memcpy (&data_buf[data_ptr], &plugins[i].protocol_version , sizeof (int ));
1111
1120
data_ptr += sizeof (int );
1112
1121
}
1113
-
1122
+
1114
1123
NetPacketHeader reply_hdr;
1115
1124
unsigned int reply_size;
1116
1125
0 commit comments