Hi, list
I downloaded OpenSSL 1.0 beta3 and found a bug in the function
BIO_get_accept_socket(), when dealing with an IPv6 address.

The line below copies the content of `res->ai_addr' to `server', but
sizeof(server) = 16, while for IPv6 address, res->ai_addrlen is 28.
i.e, sizeof(struct sockadr_in6).  The missing 12 bytes will cause
the later bind() always fail.

 struct sockaddr server,client;
 server = *res->ai_addr;

To fix it, I use the type `struct sockaddr_storage' to hold the
address information so that its storage can satisfy any type of socket
address, for example:

 struct sockaddr_storage server,client;
 memcpy(&server, res->ai_addr, res->ai_addrlen);

Pls see the patch in attachment for details.

-- 
Thanks,
Li Qun

Attachment: fix-ipv6-handling.patch
Description: Binary data

Reply via email to