--- a/src/core.c
+++ b/src/core.c
@@ -273,9 +273,9 @@ static int core_udp_listen(nc_sock_t *nc
 	dup_socket.domain = ncsock->domain;
 	dup_socket.proto = ncsock->proto;
 	memcpy(&dup_socket.local_host.iaddrs[0], &local_addr.sin_addr,
-	       sizeof(local_addr));
+	       sizeof(local_addr.sin_addr));
 	memcpy(&dup_socket.host.iaddrs[0], &rem_addr.sin_addr,
-	       sizeof(local_addr));
+	       sizeof(rem_addr.sin_addr));
 	dup_socket.local_port.netnum = local_addr.sin_port;
 	dup_socket.local_port.num = ntohs(local_addr.sin_port);
 	dup_socket.port.netnum = rem_addr.sin_port;
