]> git.meshlink.io Git - meshlink/commitdiff
Use memcpy() to copy sockaddrs returned by getaddrinfo().
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 11 Jun 2006 18:53:27 +0000 (18:53 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 11 Jun 2006 18:53:27 +0000 (18:53 +0000)
Thanks to Miles Nordin for spotting this.

THANKS
src/net_setup.c
src/netutl.c

diff --git a/THANKS b/THANKS
index 21176e21089e4ba19c96921756c2f61d3da98113..d4693264128760f61819f76edfc3b7d883fe5507 100644 (file)
--- a/THANKS
+++ b/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
index b3ce766d371ca6b0ab3ccc6180c6ac1f67ebbe7c..d03869e624ea5e9e327e3d921ac8679493c34000 100644 (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++;
        }
 
index d321fb275d3721f903ca0ff0d8bb70e9fd11d667..6386e4cfff0cc5bef7780b9bdebaea636814f116 100644 (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;