From 11f7e1ce1f76b7c1b04d5cba057f4e22d23b24f2 Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Sat, 14 Oct 2006 19:46:21 +0000 Subject: [PATCH] Safer way to initialize the address. --- btpd/peer.c | 4 ++-- 1 file 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;