diff options
author | Philipp Tölke <toelke@in.tum.de> | 2011-06-15 07:15:34 +0000 |
---|---|---|
committer | Philipp Tölke <toelke@in.tum.de> | 2011-06-15 07:15:34 +0000 |
commit | 331582ad4f7b929515171b67b1b011fbd3b70265 (patch) | |
tree | 0d230a90aa9c7c36211ed945af3b00bcbdb99ce3 /src/vpn | |
parent | 728fb46aebbf873afd67433c6abb5e6375d0c535 (diff) |
better portability
Diffstat (limited to 'src/vpn')
-rw-r--r-- | src/vpn/gnunet-daemon-exit.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/vpn/gnunet-daemon-exit.c b/src/vpn/gnunet-daemon-exit.c index 8abfdc31f8..2f8ce774b8 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)); } /** |