crypto/bio/b_sock.c:700: error: UNINITIALIZED_VALUE
  The value read from server.ss_family was never initialized.
Showing all 1 steps of the trace


crypto/bio/b_sock.c:700:4: 
698.   
699.   again:
700. > 	s=socket(ossl_sock_family(server),SOCK_STREAM,SOCKET_PROTOCOL);
701.   	if (s == INVALID_SOCKET)
702.   		{

int BIO_get_accept_socket(char *host, int bind_mode)
	{
	int ret=0;
#if OPENSSL_USE_IPV6
# define ossl_sock_family(s) s.ss_family
	struct sockaddr_storage server,client;
#else
# define ossl_sock_family(s) s.sa_family
	struct sockaddr server,client;
#endif
	struct sockaddr_in *sa_in;
	int s=INVALID_SOCKET,cs;
	unsigned char ip[4];
	unsigned short port;
	char *str=NULL,*e;
	char *h,*p;
	unsigned long l;
	int err_num;
	if (BIO_sock_init() != 1) return(INVALID_SOCKET);
	if ((str=BUF_strdup(host)) == NULL) return(INVALID_SOCKET);
	h=p=NULL;
	h=str;
	for (e=str; *e; e++)
		{
		if (*e == ':')
			{
			p=e;
			}
		else if (*e == '/')
			{
			*e='\0';
			break;
			}
		}
	if (p)	*p++='\0';
	else	p=h,h=NULL;
#ifdef EAI_FAMILY
	do {
	static union {	void *p;
			int (*f)(const char *,const char *,
				 const struct addrinfo *,
				 struct addrinfo **);
			} p_getaddrinfo = {NULL};
	static union {	void *p;
			void (*f)(struct addrinfo *);
			} p_freeaddrinfo = {NULL};
	struct addrinfo *res,hint;
	if (p_getaddrinfo.p==NULL)
		{
		if ((p_getaddrinfo.p=DSO_global_lookup("getaddrinfo"))==NULL ||
		    (p_freeaddrinfo.p=DSO_global_lookup("freeaddrinfo"))==NULL)
			p_getaddrinfo.p=(void*)-1;
		}
	if (p_getaddrinfo.p==(void *)-1) break;
	memset(&hint,0,sizeof(hint));
	if (h)
		{
		if (strchr(h,':'))
			{
			if (h[1]=='\0') h=NULL;
#if OPENSSL_USE_IPV6
			hint.ai_family = AF_INET6;
#else
			h=NULL;
#endif
			}
	    	else if (h[0]=='*' && h[1]=='\0')
			h=NULL;
		}
	if ((*p_getaddrinfo.f)(h,p,&hint,&res)) break;
#if OPENSSL_USE_IPV6
	memcpy(&server, res->ai_addr, res->ai_addrlen);
#else
	server = *res->ai_addr;
#endif
	(*p_freeaddrinfo.f)(res);
	goto again;
	} while (0);
#endif
	if (!BIO_get_port(p,&port)) goto err;
	memset((char *)&server,0,sizeof(server));
	sa_in = (struct sockaddr_in *)&server;
	sa_in->sin_family=AF_INET;
	sa_in->sin_port=htons(port);
	if (h == NULL || strcmp(h,"*") == 0)
		sa_in->sin_addr.s_addr=INADDR_ANY;
	else
		{
                if (!BIO_get_host_ip(h,&(ip[0]))) goto err;
		l=(unsigned long)
			((unsigned long)ip[0]<<24L)|
			((unsigned long)ip[1]<<16L)|
			((unsigned long)ip[2]<< 8L)|
			((unsigned long)ip[3]);
		sa_in->sin_addr.s_addr=htonl(l);
		}
again:
	s=socket(ossl_sock_family(server),SOCK_STREAM,SOCKET_PROTOCOL);
	if (s == INVALID_SOCKET)
		{
		SYSerr(SYS_F_SOCKET,get_last_socket_error());
		ERR_add_error_data(3,"port='",host,"'");
		BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_UNABLE_TO_CREATE_SOCKET);
		goto err;
		}
#ifdef SO_REUSEADDR
	if (bind_mode == BIO_BIND_REUSEADDR)
		{
		int i=1;
		ret=setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&i,sizeof(i));
		bind_mode=BIO_BIND_NORMAL;
		}
#endif
	if (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1)
		{
#ifdef SO_REUSEADDR
		err_num=get_last_socket_error();
		if ((bind_mode == BIO_BIND_REUSEADDR_IF_UNUSED) &&
			(err_num == EADDRINUSE))
			{
			client = server;
			if (h == NULL || strcmp(h,"*") == 0)
				{
#if OPENSSL_USE_IPV6
				if (ossl_sock_family(client) == AF_INET6)
					{
					struct sockaddr_in6 *sin6 =
						(struct sockaddr_in6 *)&client;
					memset(&sin6->sin6_addr,0,sizeof(sin6->sin6_addr));
					sin6->sin6_addr.s6_addr[15]=1;
					}
				else
#endif
				if (ossl_sock_family(client) == AF_INET)
					{
					struct sockaddr_in *sin4 =
						(struct sockaddr_in *)&client;
					sin4->sin_addr.s_addr=htonl(0x7F000001);
					}
				else	goto err;
				}
			cs=socket(ossl_sock_family(client),SOCK_STREAM,SOCKET_PROTOCOL);
			if (cs != INVALID_SOCKET)
				{
				int ii;
				ii=connect(cs,(struct sockaddr *)&client,
					sizeof(client));
				closesocket(cs);
				if (ii == INVALID_SOCKET)
					{
					bind_mode=BIO_BIND_REUSEADDR;
					closesocket(s);
					goto again;
					}
				}
			}
#endif
		SYSerr(SYS_F_BIND,err_num);
		ERR_add_error_data(3,"port='",host,"'");
		BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_UNABLE_TO_BIND_SOCKET);
		goto err;
		}
	if (listen(s,MAX_LISTEN) == -1)
		{
		SYSerr(SYS_F_BIND,get_last_socket_error());
		ERR_add_error_data(3,"port='",host,"'");
		BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_UNABLE_TO_LISTEN_SOCKET);
		goto err;
		}
	ret=1;
err:
	if (str != NULL) OPENSSL_free(str);
	if ((ret == 0) && (s != INVALID_SOCKET))
		{
		closesocket(s);
		s= INVALID_SOCKET;
		}
	return(s);
	}
['int BIO_get_accept_socket(char *host, int bind_mode)\n\t{\n\tint ret=0;\n#if OPENSSL_USE_IPV6\n# define ossl_sock_family(s) s.ss_family\n\tstruct sockaddr_storage server,client;\n#else\n# define ossl_sock_family(s) s.sa_family\n\tstruct sockaddr server,client;\n#endif\n\tstruct sockaddr_in *sa_in;\n\tint s=INVALID_SOCKET,cs;\n\tunsigned char ip[4];\n\tunsigned short port;\n\tchar *str=NULL,*e;\n\tchar *h,*p;\n\tunsigned long l;\n\tint err_num;\n\tif (BIO_sock_init() != 1) return(INVALID_SOCKET);\n\tif ((str=BUF_strdup(host)) == NULL) return(INVALID_SOCKET);\n\th=p=NULL;\n\th=str;\n\tfor (e=str; *e; e++)\n\t\t{\n\t\tif (*e == \':\')\n\t\t\t{\n\t\t\tp=e;\n\t\t\t}\n\t\telse if (*e == \'/\')\n\t\t\t{\n\t\t\t*e=\'\\0\';\n\t\t\tbreak;\n\t\t\t}\n\t\t}\n\tif (p)\t*p++=\'\\0\';\n\telse\tp=h,h=NULL;\n#ifdef EAI_FAMILY\n\tdo {\n\tstatic union {\tvoid *p;\n\t\t\tint (*f)(const char *,const char *,\n\t\t\t\t const struct addrinfo *,\n\t\t\t\t struct addrinfo **);\n\t\t\t} p_getaddrinfo = {NULL};\n\tstatic union {\tvoid *p;\n\t\t\tvoid (*f)(struct addrinfo *);\n\t\t\t} p_freeaddrinfo = {NULL};\n\tstruct addrinfo *res,hint;\n\tif (p_getaddrinfo.p==NULL)\n\t\t{\n\t\tif ((p_getaddrinfo.p=DSO_global_lookup("getaddrinfo"))==NULL ||\n\t\t    (p_freeaddrinfo.p=DSO_global_lookup("freeaddrinfo"))==NULL)\n\t\t\tp_getaddrinfo.p=(void*)-1;\n\t\t}\n\tif (p_getaddrinfo.p==(void *)-1) break;\n\tmemset(&hint,0,sizeof(hint));\n\tif (h)\n\t\t{\n\t\tif (strchr(h,\':\'))\n\t\t\t{\n\t\t\tif (h[1]==\'\\0\') h=NULL;\n#if OPENSSL_USE_IPV6\n\t\t\thint.ai_family = AF_INET6;\n#else\n\t\t\th=NULL;\n#endif\n\t\t\t}\n\t    \telse if (h[0]==\'*\' && h[1]==\'\\0\')\n\t\t\th=NULL;\n\t\t}\n\tif ((*p_getaddrinfo.f)(h,p,&hint,&res)) break;\n#if OPENSSL_USE_IPV6\n\tmemcpy(&server, res->ai_addr, res->ai_addrlen);\n#else\n\tserver = *res->ai_addr;\n#endif\n\t(*p_freeaddrinfo.f)(res);\n\tgoto again;\n\t} while (0);\n#endif\n\tif (!BIO_get_port(p,&port)) goto err;\n\tmemset((char *)&server,0,sizeof(server));\n\tsa_in = (struct sockaddr_in *)&server;\n\tsa_in->sin_family=AF_INET;\n\tsa_in->sin_port=htons(port);\n\tif (h == NULL || strcmp(h,"*") == 0)\n\t\tsa_in->sin_addr.s_addr=INADDR_ANY;\n\telse\n\t\t{\n                if (!BIO_get_host_ip(h,&(ip[0]))) goto err;\n\t\tl=(unsigned long)\n\t\t\t((unsigned long)ip[0]<<24L)|\n\t\t\t((unsigned long)ip[1]<<16L)|\n\t\t\t((unsigned long)ip[2]<< 8L)|\n\t\t\t((unsigned long)ip[3]);\n\t\tsa_in->sin_addr.s_addr=htonl(l);\n\t\t}\nagain:\n\ts=socket(ossl_sock_family(server),SOCK_STREAM,SOCKET_PROTOCOL);\n\tif (s == INVALID_SOCKET)\n\t\t{\n\t\tSYSerr(SYS_F_SOCKET,get_last_socket_error());\n\t\tERR_add_error_data(3,"port=\'",host,"\'");\n\t\tBIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_UNABLE_TO_CREATE_SOCKET);\n\t\tgoto err;\n\t\t}\n#ifdef SO_REUSEADDR\n\tif (bind_mode == BIO_BIND_REUSEADDR)\n\t\t{\n\t\tint i=1;\n\t\tret=setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&i,sizeof(i));\n\t\tbind_mode=BIO_BIND_NORMAL;\n\t\t}\n#endif\n\tif (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1)\n\t\t{\n#ifdef SO_REUSEADDR\n\t\terr_num=get_last_socket_error();\n\t\tif ((bind_mode == BIO_BIND_REUSEADDR_IF_UNUSED) &&\n\t\t\t(err_num == EADDRINUSE))\n\t\t\t{\n\t\t\tclient = server;\n\t\t\tif (h == NULL || strcmp(h,"*") == 0)\n\t\t\t\t{\n#if OPENSSL_USE_IPV6\n\t\t\t\tif (ossl_sock_family(client) == AF_INET6)\n\t\t\t\t\t{\n\t\t\t\t\tstruct sockaddr_in6 *sin6 =\n\t\t\t\t\t\t(struct sockaddr_in6 *)&client;\n\t\t\t\t\tmemset(&sin6->sin6_addr,0,sizeof(sin6->sin6_addr));\n\t\t\t\t\tsin6->sin6_addr.s6_addr[15]=1;\n\t\t\t\t\t}\n\t\t\t\telse\n#endif\n\t\t\t\tif (ossl_sock_family(client) == AF_INET)\n\t\t\t\t\t{\n\t\t\t\t\tstruct sockaddr_in *sin4 =\n\t\t\t\t\t\t(struct sockaddr_in *)&client;\n\t\t\t\t\tsin4->sin_addr.s_addr=htonl(0x7F000001);\n\t\t\t\t\t}\n\t\t\t\telse\tgoto err;\n\t\t\t\t}\n\t\t\tcs=socket(ossl_sock_family(client),SOCK_STREAM,SOCKET_PROTOCOL);\n\t\t\tif (cs != INVALID_SOCKET)\n\t\t\t\t{\n\t\t\t\tint ii;\n\t\t\t\tii=connect(cs,(struct sockaddr *)&client,\n\t\t\t\t\tsizeof(client));\n\t\t\t\tclosesocket(cs);\n\t\t\t\tif (ii == INVALID_SOCKET)\n\t\t\t\t\t{\n\t\t\t\t\tbind_mode=BIO_BIND_REUSEADDR;\n\t\t\t\t\tclosesocket(s);\n\t\t\t\t\tgoto again;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n#endif\n\t\tSYSerr(SYS_F_BIND,err_num);\n\t\tERR_add_error_data(3,"port=\'",host,"\'");\n\t\tBIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_UNABLE_TO_BIND_SOCKET);\n\t\tgoto err;\n\t\t}\n\tif (listen(s,MAX_LISTEN) == -1)\n\t\t{\n\t\tSYSerr(SYS_F_BIND,get_last_socket_error());\n\t\tERR_add_error_data(3,"port=\'",host,"\'");\n\t\tBIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_UNABLE_TO_LISTEN_SOCKET);\n\t\tgoto err;\n\t\t}\n\tret=1;\nerr:\n\tif (str != NULL) OPENSSL_free(str);\n\tif ((ret == 0) && (s != INVALID_SOCKET))\n\t\t{\n\t\tclosesocket(s);\n\t\ts= INVALID_SOCKET;\n\t\t}\n\treturn(s);\n\t}']