Fix length of argument for connect() to work with IPv6

This line was resulting in the sizeof(struct socketaddr)
connect_addr_len = sizeof(*addr->ai_addr);

The correct syntax is to explicitly get the sizeof(struct sockaddr_in6)
since we are dealing with IPv6 addresses.
This commit is contained in:
Ubuntu 2022-08-10 19:15:38 +00:00
Родитель ca14543a46
Коммит 6dfd032d39
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -311,7 +311,7 @@ static int initiate_socket_connection(SOCKET_IO_INSTANCE* socket_io_instance)
else
{
connect_addr = (struct sockaddr_in6*) addr->ai_addr;
connect_addr_len = sizeof(*addr->ai_addr);
connect_addr_len = sizeof(struct sockaddr_in6);
result = 0;
}
}