From 82931ae20f9df8f4fd2dd49a873cabd5b9c6a5e9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 21 Oct 2010 13:22:46 +0000 Subject: [PATCH] minus --- src/fs/gnunet-service-fs.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index f59f18546..da0e2a28f 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -1581,7 +1581,14 @@ peer_connect_handler (void *cls, struct MigrationReadyBlock *pos; char *fn; uint32_t trust; - + + cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, + &peer->hashPubKey); + if (NULL != cp) + { + GNUNET_break (0); + return; + } cp = GNUNET_malloc (sizeof (struct ConnectedPeer)); cp->transmission_delay = GNUNET_LOAD_value_init (latency); cp->pid = GNUNET_PEER_intern (peer); @@ -4018,7 +4025,13 @@ handle_p2p_get (void *cls, return GNUNET_SYSERR; } opt = (const GNUNET_HashCode*) &gm[1]; - bfsize = msize - sizeof (struct GetMessage) + bits * sizeof (GNUNET_HashCode); + bfsize = msize - sizeof (struct GetMessage) - bits * sizeof (GNUNET_HashCode); + /* bfsize must be power of 2, check! */ + if (0 != ( (bfsize - 1) & bfsize)) + { + GNUNET_break_op (0); + return GNUNET_SYSERR; + } bm = ntohl (gm->hash_bitmap); bits = 0; cps = GNUNET_CONTAINER_multihashmap_get (connected_peers, -- 2.25.1