{
bool is_requested = false;
connection_error_e result = CONNECTION_ERROR_NONE;
- connection_handle_s *conn_handle = (connection_handle_s *)user_data;
+ CONN_LOCK;
+ connection_handle_s conn_handle_local;
+ connection_handle_s *conn_handle = &conn_handle_local;
+ connection_handle_s *conn_handle_origin = (connection_handle_s *)user_data;
+
+ if(!_connection_check_handle_validity(conn_handle_origin)) {
+ CONNECTION_LOG(CONNECTION_INFO, "Invalid handle");
+ CONN_UNLOCK;
+ return;
+ }
+ memcpy(conn_handle, conn_handle_origin, sizeof(connection_handle_s));
+ CONN_UNLOCK;
switch (event_cb->Event) {
case NET_EVENT_OPEN_RSP: