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


crypto/bio/b_sock.c:672:4: 
670.   
671.   again:
672. > 	s=socket(server.sa_family,SOCK_STREAM,SOCKET_PROTOCOL);
673.   	if (s == INVALID_SOCKET)
674.   		{

int BIO_get_accept_socket(char *host, int bind_mode)
	{
	int ret=0;
	struct sockaddr server,client;
	struct sockaddr_in *sin;
	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 **);
			} getaddrinfo = {NULL};
	static union {	void *p;
			void (*f)(struct addrinfo *);
			} freeaddrinfo = {NULL};
	struct addrinfo *res,hint;
	if (getaddrinfo.p==NULL)
		{
		if ((getaddrinfo.p=DSO_global_lookup("getaddrinfo"))==NULL ||
		    (freeaddrinfo.p=DSO_global_lookup("freeaddrinfo"))==NULL)
			getaddrinfo.p=(void*)-1;
		}
	if (getaddrinfo.p==(void *)-1) break;
	memset(&hint,0,sizeof(hint));
	if (h && strchr(h,':')) hint.ai_family = AF_INET6;
	if ((*getaddrinfo.f)(h,p,&hint,&res)) break;
	server = *res->ai_addr;
	(*freeaddrinfo.f)(res);
	goto again;
	} while (0);
#endif
	if (!BIO_get_port(p,&port)) goto err;
	memset((char *)&server,0,sizeof(server));
	sin = (struct sockaddr_in *)&server;
	sin->sin_family=AF_INET;
	sin->sin_port=htons(port);
	if (h == NULL || strcmp(h,"*") == 0)
		sin->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]);
		sin->sin_addr.s_addr=htonl(l);
		}
again:
	s=socket(server.sa_family,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,&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)
				{
#ifdef AF_INET6
				if (client.sa_family == AF_INET6)
					{
					struct sockaddr_in6 *sin =
						(struct sockaddr_in6 *)&client;
					memset(&sin->sin6_addr,0,sizeof(sin->sin6_addr));
					sin->sin6_addr.s6_addr[15]=1;
					}
				else
#endif
				if (client.sa_family == AF_INET)
					{
					struct sockaddr_in *sin =
						(struct sockaddr_in *)&client;
					sin->sin_addr.s_addr=htonl(0x7F000001);
					}
				else	goto err;
				}
			cs=socket(client.sa_family,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\tstruct sockaddr server,client;\n\tstruct sockaddr_in *sin;\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} getaddrinfo = {NULL};\n\tstatic union {\tvoid *p;\n\t\t\tvoid (*f)(struct addrinfo *);\n\t\t\t} freeaddrinfo = {NULL};\n\tstruct addrinfo *res,hint;\n\tif (getaddrinfo.p==NULL)\n\t\t{\n\t\tif ((getaddrinfo.p=DSO_global_lookup("getaddrinfo"))==NULL ||\n\t\t    (freeaddrinfo.p=DSO_global_lookup("freeaddrinfo"))==NULL)\n\t\t\tgetaddrinfo.p=(void*)-1;\n\t\t}\n\tif (getaddrinfo.p==(void *)-1) break;\n\tmemset(&hint,0,sizeof(hint));\n\tif (h && strchr(h,\':\')) hint.ai_family = AF_INET6;\n\tif ((*getaddrinfo.f)(h,p,&hint,&res)) break;\n\tserver = *res->ai_addr;\n\t(*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\tsin = (struct sockaddr_in *)&server;\n\tsin->sin_family=AF_INET;\n\tsin->sin_port=htons(port);\n\tif (h == NULL || strcmp(h,"*") == 0)\n\t\tsin->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\tsin->sin_addr.s_addr=htonl(l);\n\t\t}\nagain:\n\ts=socket(server.sa_family,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,&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#ifdef AF_INET6\n\t\t\t\tif (client.sa_family == AF_INET6)\n\t\t\t\t\t{\n\t\t\t\t\tstruct sockaddr_in6 *sin =\n\t\t\t\t\t\t(struct sockaddr_in6 *)&client;\n\t\t\t\t\tmemset(&sin->sin6_addr,0,sizeof(sin->sin6_addr));\n\t\t\t\t\tsin->sin6_addr.s6_addr[15]=1;\n\t\t\t\t\t}\n\t\t\t\telse\n#endif\n\t\t\t\tif (client.sa_family == AF_INET)\n\t\t\t\t\t{\n\t\t\t\t\tstruct sockaddr_in *sin =\n\t\t\t\t\t\t(struct sockaddr_in *)&client;\n\t\t\t\t\tsin->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(client.sa_family,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}']