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
|
* Mark Glines
|
||||||
* Martin Kihlgren
|
* Martin Kihlgren
|
||||||
* Matias Carrasco
|
* Matias Carrasco
|
||||||
|
* Miles Nordin
|
||||||
* Nick Patavalis
|
* Nick Patavalis
|
||||||
* Paul Littlefield
|
* Paul Littlefield
|
||||||
* Robert van der Meulen
|
* Robert van der Meulen
|
||||||
|
|
|
@ -502,7 +502,7 @@ bool setup_myself(void)
|
||||||
free(hostname);
|
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++;
|
listen_sockets++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ sockaddr_t str2sockaddr(const char *address, const char *port)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = *(sockaddr_t *) ai->ai_addr;
|
memcpy(&result, ai->ai_addr, ai->ai_addrlen);
|
||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Reference in a new issue