Fixes the following memory access error spotted by valgrind:
Invalid read of size 4
at 0x10D6D3: uh_socket_bind (listen.c:192)
by 0x10C830: add_listener_arg (main.c:128)
by 0x10C830: main (main.c:325)
Address 0x4aa1160 is 0 bytes after a block of size 64 alloc'd
at 0x483877F: malloc (vg_replace_malloc.c:307)
by 0x49ACAC5: gaih_inet.constprop.0 (getaddrinfo.c:1058)
by 0x49AE224: getaddrinfo (getaddrinfo.c:2256)
by 0x10D590: uh_socket_bind (listen.c:145)
by 0x10C830: add_listener_arg (main.c:128)
by 0x10C830: main (main.c:325)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
l->fd.fd = sock;
l->tls = tls;
- l->addr = *(struct sockaddr_in6 *)p->ai_addr;
+ memcpy(&l->addr, p->ai_addr, p->ai_addrlen);
list_add_tail(&l->list, &listeners);
bound++;