@@ -169,7 +169,7 @@ static int del_accepted(TCP_Server *TCP_server, int index)
169169 if (!bs_list_remove (& TCP_server -> accepted_key_list , TCP_server -> accepted_connection_array [index ].public_key , index ))
170170 return -1 ;
171171
172- memset (& TCP_server -> accepted_connection_array [index ], 0 , sizeof (TCP_Secure_Connection ));
172+ sodium_memzero (& TCP_server -> accepted_connection_array [index ], sizeof (TCP_Secure_Connection ));
173173 -- TCP_server -> num_accepted_connections ;
174174
175175 if (TCP_server -> num_accepted_connections == 0 )
@@ -447,7 +447,7 @@ static int write_packet_TCP_secure_connection(TCP_Secure_Connection *con, const
447447static void kill_TCP_connection (TCP_Secure_Connection * con )
448448{
449449 kill_sock (con -> sock );
450- memset (con , 0 , sizeof (TCP_Secure_Connection ));
450+ sodium_memzero (con , sizeof (TCP_Secure_Connection ));
451451}
452452
453453static int rm_connection_index (TCP_Server * TCP_server , TCP_Secure_Connection * con , uint8_t con_number );
@@ -868,7 +868,7 @@ static int confirm_TCP_connection(TCP_Server *TCP_server, TCP_Secure_Connection
868868 return -1 ;
869869 }
870870
871- memset (con , 0 , sizeof (TCP_Secure_Connection ));
871+ sodium_memzero (con , sizeof (TCP_Secure_Connection ));
872872
873873 if (handle_TCP_packet (TCP_server , index , data , length ) == -1 ) {
874874 kill_accepted (TCP_server , index );
@@ -1056,7 +1056,7 @@ static int do_incoming(TCP_Server *TCP_server, uint32_t i)
10561056 kill_TCP_connection (conn_new );
10571057
10581058 memcpy (conn_new , conn_old , sizeof (TCP_Secure_Connection ));
1059- memset (conn_old , 0 , sizeof (TCP_Secure_Connection ));
1059+ sodium_memzero (conn_old , sizeof (TCP_Secure_Connection ));
10601060 ++ TCP_server -> unconfirmed_connection_queue_index ;
10611061
10621062 return index_new ;
0 commit comments