Use memcpy() to copy sockaddrs returned by getaddrinfo().

Thanks to Miles Nordin for spotting this.
This commit is contained in:
Guus Sliepen 2006-06-11 18:53:27 +00:00
parent 412f3fb510
commit f88c9942e1
3 changed files with 3 additions and 2 deletions

1
THANKS
View file

@ -20,6 +20,7 @@ We would like to thank the following people for their contributions to tinc:
* Mark Glines
* Martin Kihlgren
* Matias Carrasco
* Miles Nordin
* Nick Patavalis
* Paul Littlefield
* Robert van der Meulen

View file

@ -502,7 +502,7 @@ bool setup_myself(void)
free(hostname);
}
listen_socket[listen_sockets].sa.sa = *aip->ai_addr;
memcpy(&listen_socket[listen_sockets].sa, aip->ai_addr, aip->ai_addrlen);
listen_sockets++;
}

View file

@ -78,7 +78,7 @@ sockaddr_t str2sockaddr(const char *address, const char *port)
return result;
}
result = *(sockaddr_t *) ai->ai_addr;
memcpy(&result, ai->ai_addr, ai->ai_addrlen);
freeaddrinfo(ai);
return result;