Sat Aug 15 01:25:54 2009 UTC ()
This code is really broken. It allocates struct sockaddr on the stack
and expects to work with IPV6. Tell the hints that we only want IPV4
for now, so that we don't try to bind to an IPV6 address as returned
by getaddrinfo, and then we bash in V4 in the family!
jeez


(christos)
diff -r1.1.1.1 -r1.2 src/crypto/external/bsd/openssl/dist/crypto/bio/b_sock.c

cvs diff -r1.1.1.1 -r1.2 src/crypto/external/bsd/openssl/dist/crypto/bio/Attic/b_sock.c (expand / switch to unified diff)

--- src/crypto/external/bsd/openssl/dist/crypto/bio/Attic/b_sock.c 2009/07/19 23:03:00 1.1.1.1
+++ src/crypto/external/bsd/openssl/dist/crypto/bio/Attic/b_sock.c 2009/08/15 01:25:54 1.2
@@ -653,26 +653,28 @@ int BIO_get_accept_socket(char *host, in @@ -653,26 +653,28 @@ int BIO_get_accept_socket(char *host, in
653 { 653 {
654 if (strchr(h,':')) 654 if (strchr(h,':'))
655 { 655 {
656 if (h[1]=='\0') h=NULL; 656 if (h[1]=='\0') h=NULL;
657#ifdef AF_INET6 657#ifdef AF_INET6
658 hint.ai_family = AF_INET6; 658 hint.ai_family = AF_INET6;
659#else 659#else
660 h=NULL; 660 h=NULL;
661#endif 661#endif
662 } 662 }
663 else if (h[0]=='*' && h[1]=='\0') 663 else if (h[0]=='*' && h[1]=='\0')
664 h=NULL; 664 h=NULL;
665 } 665 }
 666 /* XXX: below we cast to sockaddr_in! */
 667 hint.ai_family = AF_INET;
666 668
667 if ((*p_getaddrinfo.f)(h,p,&hint,&res)) break; 669 if ((*p_getaddrinfo.f)(h,p,&hint,&res)) break;
668 server = *res->ai_addr; 670 server = *res->ai_addr;
669 (*p_freeaddrinfo.f)(res); 671 (*p_freeaddrinfo.f)(res);
670 goto again; 672 goto again;
671 } while (0); 673 } while (0);
672#endif 674#endif
673 675
674 if (!BIO_get_port(p,&port)) goto err; 676 if (!BIO_get_port(p,&port)) goto err;
675 677
676 memset((char *)&server,0,sizeof(server)); 678 memset((char *)&server,0,sizeof(server));
677 sa_in = (struct sockaddr_in *)&server; 679 sa_in = (struct sockaddr_in *)&server;
678 sa_in->sin_family=AF_INET; 680 sa_in->sin_family=AF_INET;