Use memcpy() to copy sockaddrs returned by getaddrinfo().
Thanks to Miles Nordin for spotting this.
This commit is contained in:
parent
412f3fb510
commit
f88c9942e1
3 changed files with 3 additions and 2 deletions
1
THANKS
1
THANKS
|
@ -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
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue