> [openssl-...@openssl.org - Thu Sep 17 16:32:23 2009]:
> 
> 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.
> 

How portable is this code? Would it work on all systems not supporting
IPv6 or should it all be surrounded by #if OPENSSL_USE_IPV6?

Steve.
-- 
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to