diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-07-02 16:02:28 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-07-02 16:02:28 +0000 |
commit | 29cf3c9a615e5af2192a10055988434bc5abbe41 (patch) | |
tree | 2d76fdd9b819124ad3d19e4f1b02cc8dce4a95d6 /src/dht/gnunet-service-dht.c | |
parent | 4864cd9ec24e9c45c64b7e3624eb3c65ac8f171f (diff) | |
download | gnunet-29cf3c9a615e5af2192a10055988434bc5abbe41.tar.gz gnunet-29cf3c9a615e5af2192a10055988434bc5abbe41.zip |
codesonar fixes, hopefully doesn't break anything
Diffstat (limited to 'src/dht/gnunet-service-dht.c')
-rw-r--r-- | src/dht/gnunet-service-dht.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index e64b9a1ea..a310cc944 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c | |||
@@ -42,7 +42,7 @@ | |||
42 | /** | 42 | /** |
43 | * Handle to the datacache service (for inserting/retrieving data) | 43 | * Handle to the datacache service (for inserting/retrieving data) |
44 | */ | 44 | */ |
45 | struct GNUNET_DATACACHE_Handle *datacache; | 45 | static struct GNUNET_DATACACHE_Handle *datacache; |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * The main scheduler to use for the DHT service | 48 | * The main scheduler to use for the DHT service |
@@ -443,7 +443,12 @@ handle_dht_find_peer (void *cls, | |||
443 | /* Simplistic find_peer functionality, always return our hello */ | 443 | /* Simplistic find_peer functionality, always return our hello */ |
444 | hello_size = ntohs(my_hello->size); | 444 | hello_size = ntohs(my_hello->size); |
445 | tsize = hello_size + sizeof (struct GNUNET_MessageHeader); | 445 | tsize = hello_size + sizeof (struct GNUNET_MessageHeader); |
446 | // check tsize < MAX | 446 | |
447 | if (tsize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | ||
448 | { | ||
449 | GNUNET_break_op (0); | ||
450 | return; | ||
451 | } | ||
447 | find_peer_result = GNUNET_malloc (tsize); | 452 | find_peer_result = GNUNET_malloc (tsize); |
448 | find_peer_result->type = htons (GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT); | 453 | find_peer_result->type = htons (GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT); |
449 | find_peer_result->size = htons (tsize); | 454 | find_peer_result->size = htons (tsize); |
@@ -604,7 +609,7 @@ handle_dht_start_message (void *cls, struct GNUNET_SERVER_Client *client, | |||
604 | * @param client the client we received this message from | 609 | * @param client the client we received this message from |
605 | * @param message the actual message received | 610 | * @param message the actual message received |
606 | * | 611 | * |
607 | * TODO: once message are remembered by unique id, add code to | 612 | * TODO: once messages are remembered by unique id, add code to |
608 | * forget them here | 613 | * forget them here |
609 | */ | 614 | */ |
610 | static void | 615 | static void |
@@ -800,6 +805,8 @@ void handle_core_connect (void *cls, | |||
800 | "%s Inserting data %s, type %d into datacache, return value was %d\n", my_short_id, GNUNET_h2s(&peer->hashPubKey), 130, ret); | 805 | "%s Inserting data %s, type %d into datacache, return value was %d\n", my_short_id, GNUNET_h2s(&peer->hashPubKey), 130, ret); |
801 | #endif | 806 | #endif |
802 | } | 807 | } |
808 | else | ||
809 | GNUNET_free(data); | ||
803 | } | 810 | } |
804 | 811 | ||
805 | /** | 812 | /** |