From 331582ad4f7b929515171b67b1b011fbd3b70265 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philipp=20T=C3=B6lke?= Date: Wed, 15 Jun 2011 07:15:34 +0000 Subject: [PATCH] better portability --- src/vpn/gnunet-daemon-exit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/vpn/gnunet-daemon-exit.c b/src/vpn/gnunet-daemon-exit.c index 8abfdc31f..2f8ce774b 100644 --- a/src/vpn/gnunet-daemon-exit.c +++ b/src/vpn/gnunet-daemon-exit.c @@ -209,13 +209,14 @@ static void hash_redirect_info(GNUNET_HashCode* hash, struct redirect_info* u_i, size_t addrlen) { - /* the gnunet hashmap only uses the first 32bit of the hash + /* the gnunet hashmap only uses the first sizeof(unsigned int) of the hash * - * build the hash out of the last two bytes of the address and the 2 bytes of + * build the hash out of the last bytes of the address and the 2 bytes of * the port */ - memcpy(&hash, &u_i->pt, sizeof(u_i->pt)); - memcpy(((unsigned char*)&hash)+2, u_i->addr+(addrlen-2), 2); + memcpy(hash, &u_i->pt, sizeof(u_i->pt)); + memcpy(((unsigned char*)hash)+2, u_i->addr+(addrlen-(sizeof(unsigned int) - 2)), (sizeof(unsigned int) - 2)); + memset(((unsigned char*)hash)+sizeof(unsigned int), 0, sizeof(GNUNET_HashCode) - sizeof(unsigned int)); } /** -- 2.25.1