diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-09-13 03:02:18 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-09-13 03:02:18 +0000 |
commit | 05680649d9fe7b4a6fc54031cada1aeca0e55db1 (patch) | |
tree | b9b888ae3655eb57fecbda57516af6f091ddf046 /src/dht/gnunet-service-dht.c | |
parent | e1d2bd3ef857adf95e4f26a937ba8b8fdf003a30 (diff) | |
download | gnunet-05680649d9fe7b4a6fc54031cada1aeca0e55db1.tar.gz gnunet-05680649d9fe7b4a6fc54031cada1aeca0e55db1.zip |
Changed behavior not to crash on external data
Diffstat (limited to 'src/dht/gnunet-service-dht.c')
-rw-r--r-- | src/dht/gnunet-service-dht.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index 0cbf8315c..ff8f98a80 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c | |||
@@ -3748,8 +3748,6 @@ cache_response (struct DHT_MessageContext *msg_ctx) | |||
3748 | 3748 | ||
3749 | current_size = GNUNET_CONTAINER_multihashmap_size (forward_list.hashmap); | 3749 | current_size = GNUNET_CONTAINER_multihashmap_size (forward_list.hashmap); |
3750 | 3750 | ||
3751 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "******************************************************** GET %s\n", GNUNET_h2s_full(&msg_ctx->key)); | ||
3752 | |||
3753 | #if DELETE_WHEN_FULL | 3751 | #if DELETE_WHEN_FULL |
3754 | while (current_size >= MAX_OUTSTANDING_FORWARDS) | 3752 | while (current_size >= MAX_OUTSTANDING_FORWARDS) |
3755 | { | 3753 | { |
@@ -4609,7 +4607,7 @@ handle_dht_local_route_request (void *cls, struct GNUNET_SERVER_Client *client, | |||
4609 | msg_ctx.path_history_len = 1; | 4607 | msg_ctx.path_history_len = 1; |
4610 | } | 4608 | } |
4611 | msg_ctx.network_size = estimate_diameter (); | 4609 | msg_ctx.network_size = estimate_diameter (); |
4612 | msg_ctx.peer = &my_identity; /* FIXME NULL? Fix doxygen? */ | 4610 | msg_ctx.peer = &my_identity; /* FIXME bart NULL? Fix doxygen? */ |
4613 | msg_ctx.importance = DHT_DEFAULT_P2P_IMPORTANCE + 4; /* Make local routing a higher priority */ | 4611 | msg_ctx.importance = DHT_DEFAULT_P2P_IMPORTANCE + 4; /* Make local routing a higher priority */ |
4614 | msg_ctx.timeout = DHT_DEFAULT_P2P_TIMEOUT; | 4612 | msg_ctx.timeout = DHT_DEFAULT_P2P_TIMEOUT; |
4615 | 4613 | ||
@@ -4871,9 +4869,17 @@ handle_dht_p2p_route_request (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4871 | path_size = | 4869 | path_size = |
4872 | ntohl (incoming->outgoing_path_length) * | 4870 | ntohl (incoming->outgoing_path_length) * |
4873 | sizeof (struct GNUNET_PeerIdentity); | 4871 | sizeof (struct GNUNET_PeerIdentity); |
4874 | GNUNET_assert (ntohs (message->size) == | 4872 | /* FIXME bart: assert? remote peer can kill DHT sending malformed packets! */ |
4875 | (sizeof (struct GNUNET_DHT_P2PRouteMessage) + | 4873 | // GNUNET_assert (ntohs (message->size) == |
4876 | ntohs (enc_msg->size) + path_size)); | 4874 | // (sizeof (struct GNUNET_DHT_P2PRouteMessage) + |
4875 | // ntohs (enc_msg->size) + path_size)); | ||
4876 | if (ntohs (message->size) != | ||
4877 | (sizeof (struct GNUNET_DHT_P2PRouteMessage) + | ||
4878 | ntohs (enc_msg->size) + path_size)) | ||
4879 | { | ||
4880 | GNUNET_break_op(0); | ||
4881 | return GNUNET_YES; /* FIXME bart GNUNET_NO? */ | ||
4882 | } | ||
4877 | route_path = (char *) &incoming[1]; | 4883 | route_path = (char *) &incoming[1]; |
4878 | route_path = route_path + ntohs (enc_msg->size); | 4884 | route_path = route_path + ntohs (enc_msg->size); |
4879 | msg_ctx->path_history = | 4885 | msg_ctx->path_history = |