Fix the coverity issue (Dereference after null check) 38/225038/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 17 Feb 2020 02:42:16 +0000 (11:42 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 17 Feb 2020 02:42:16 +0000 (11:42 +0900)
Change-Id: I99343dfbc3c349302dfe2db63741fd1062d3b8e7
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-service-adaptation/services/socket/bt-service-socket.c

index a51dfde..71d9c3c 100644 (file)
@@ -212,7 +212,11 @@ int _bt_socket_client_connect(int sock_type, char *address,
        pending_conn_info->chan = channel;
        pending_conn_info->conn_cb = cb;
        g_strlcpy(pending_conn_info->address, address, BT_ADDRESS_STRING_SIZE);
-       g_strlcpy(pending_conn_info->uuid, remote_uuid, BT_UUID_STRING_SIZE);
+
+       if (remote_uuid != NULL)
+               g_strlcpy(pending_conn_info->uuid, remote_uuid, BT_UUID_STRING_SIZE);
+       else
+               memset(pending_conn_info->uuid, 0x00, BT_UUID_STRING_SIZE);
 
        BT_DBG("-");
        return BLUETOOTH_ERROR_NONE;