gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r15598 - gnunet/src/vpn


From: gnunet
Subject: [GNUnet-SVN] r15598 - gnunet/src/vpn
Date: Wed, 15 Jun 2011 09:15:34 +0200

Author: toelke
Date: 2011-06-15 09:15:34 +0200 (Wed, 15 Jun 2011)
New Revision: 15598

Modified:
   gnunet/src/vpn/gnunet-daemon-exit.c
Log:
better portability

Modified: gnunet/src/vpn/gnunet-daemon-exit.c
===================================================================
--- gnunet/src/vpn/gnunet-daemon-exit.c 2011-06-15 07:15:34 UTC (rev 15597)
+++ gnunet/src/vpn/gnunet-daemon-exit.c 2011-06-15 07:15:34 UTC (rev 15598)
@@ -209,13 +209,14 @@
 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));
 }
 
 /**




reply via email to

[Prev in Thread] Current Thread [Next in Thread]