about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2006-10-14 19:46:21 +0000
committerRichard Nyberg <rnyberg@murmeldjur.se>2006-10-14 19:46:21 +0000
commit11f7e1ce1f76b7c1b04d5cba057f4e22d23b24f2 (patch)
treebee24077728755f47f19f3004e7ba77eec2f5acd
parent3fb4e5a894b687cebd614b60f7e6284356cab5de (diff)
downloadbtpd-11f7e1ce1f76b7c1b04d5cba057f4e22d23b24f2.tar.gz
btpd-11f7e1ce1f76b7c1b04d5cba057f4e22d23b24f2.zip
Safer way to initialize the address.
-rw-r--r--btpd/peer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/btpd/peer.c b/btpd/peer.c
index 5731e05..cb34585 100644
--- a/btpd/peer.c
+++ b/btpd/peer.c
@@ -321,8 +321,8 @@ peer_create_out_compact(struct net *n, const char *compact)
     struct sockaddr_in addr;
 
     addr.sin_family = AF_INET;
-    addr.sin_addr.s_addr = *(long *)compact;
-    addr.sin_port = *(short *)(compact + 4);
+    bcopy(compact, &addr.sin_addr.s_addr, 4);
+    bcopy(compact + 4, &addr.sin_port, 2);
 
     if (net_connect2((struct sockaddr *)&addr, sizeof(addr), &sd) != 0)
         return;