summaryrefslogtreecommitdiff
path: root/src/network.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2016-07-27 22:26:32 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2016-07-27 22:26:32 -0400
commita62bff986657f8143a34a8f11478c6e054f2a0ed (patch)
tree2df6cc3e16d95da12e262c200841704e83c101e8 /src/network.c
parenta69a803e35500c2ec0ba900420452cd4db750502 (diff)
downloadlighttpd1.4-a62bff986657f8143a34a8f11478c6e054f2a0ed.tar.gz
lighttpd1.4-a62bff986657f8143a34a8f11478c6e054f2a0ed.zip
[core] fix result copy from getaddrinfo()
(thx avij)
Diffstat (limited to 'src/network.c')
-rw-r--r--src/network.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network.c b/src/network.c
index 61aeb395..4693b91b 100644
--- a/src/network.c
+++ b/src/network.c
@@ -283,10 +283,11 @@ static int network_server_init(server *srv, buffer *host_token, specific_config
if (0 != (r = getaddrinfo(host, NULL, &hints, &res))) {
hints.ai_family = AF_INET;
if (EAI_ADDRFAMILY == r && 0 == getaddrinfo(host, NULL, &hints, &res)) {
+ memcpy(&srv_socket->addr.ipv4, res->ai_addr, res->ai_addrlen);
srv_socket->addr.ipv4.sin_family = AF_INET;
srv_socket->addr.ipv4.sin_port = htons(port);
- memcpy(&(srv_socket->addr.ipv4.sin_addr.s_addr), res->ai_addr, res->ai_addrlen);
addr_len = sizeof(struct sockaddr_in);
+ /*assert(addr_len == res->ai_addrlen);*/
freeaddrinfo(res);
break;
}