提交 b3199e54 编写于 作者: A Andy Polyakov

apps/s_socket.c: fix memory sanitizer problem in ACCEPT printout.

Reviewed-by: NRich Salz <rsalz@openssl.org>
Reviewed-by: NRichard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5994)
上级 f3d3b362
......@@ -211,7 +211,7 @@ int do_server(int *accept_sock, const char *host, const char *port,
int i;
BIO_ADDRINFO *res = NULL;
const BIO_ADDRINFO *next;
int sock_family, sock_type, sock_protocol;
int sock_family, sock_type, sock_protocol, sock_port;
const BIO_ADDR *sock_address;
int sock_options = BIO_SOCK_REUSEADDR;
int ret = 0;
......@@ -280,10 +280,12 @@ int do_server(int *accept_sock, const char *host, const char *port,
}
#endif
sock_port = BIO_ADDR_rawport(sock_address);
BIO_ADDRINFO_free(res);
res = NULL;
if (BIO_ADDR_rawport(sock_address) == 0) {
if (sock_port == 0) {
/* dynamically allocated port, report which one */
union BIO_sock_info_u info;
char *hostname = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册