aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vpn/gnunet-daemon-exit.c9
1 files 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
209hash_redirect_info(GNUNET_HashCode* hash, struct redirect_info* u_i, size_t addrlen) 209hash_redirect_info(GNUNET_HashCode* hash, struct redirect_info* u_i, size_t addrlen)
210{ 210{
211 211
212 /* the gnunet hashmap only uses the first 32bit of the hash 212 /* the gnunet hashmap only uses the first sizeof(unsigned int) of the hash
213 * 213 *
214 * build the hash out of the last two bytes of the address and the 2 bytes of 214 * build the hash out of the last bytes of the address and the 2 bytes of
215 * the port 215 * the port
216 */ 216 */
217 memcpy(&hash, &u_i->pt, sizeof(u_i->pt)); 217 memcpy(hash, &u_i->pt, sizeof(u_i->pt));
218 memcpy(((unsigned char*)&hash)+2, u_i->addr+(addrlen-2), 2); 218 memcpy(((unsigned char*)hash)+2, u_i->addr+(addrlen-(sizeof(unsigned int) - 2)), (sizeof(unsigned int) - 2));
219 memset(((unsigned char*)hash)+sizeof(unsigned int), 0, sizeof(GNUNET_HashCode) - sizeof(unsigned int));
219} 220}
220 221
221/** 222/**