summaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-10-15 00:55:40 +0000
committerBart Polot <bart@net.in.tum.de>2014-10-15 00:55:40 +0000
commit48584ab51c23ea0520869fd373edd4784dd14802 (patch)
tree6c243e9827ebec59b4b3ab7eb6725137952c9bec /src/cadet
parent3dfe0b93bba61ca11519adca8a901fd07563612c (diff)
- off by one: add own ID to ID array when creating path from DHT
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/gnunet-service-cadet_dht.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c
index f18e868e3..c9cc51c0b 100644
--- a/src/cadet/gnunet-service-cadet_dht.c
+++ b/src/cadet/gnunet-service-cadet_dht.c
@@ -119,25 +119,26 @@ path_build_from_dht (const struct GNUNET_PeerIdentity *get_path,
const struct GNUNET_PeerIdentity *put_path,
unsigned int put_path_length)
{
- size_t size = get_path_length + put_path_length;
+ size_t size = get_path_length + put_path_length + 1;
struct GNUNET_PeerIdentity peers[size];
const struct GNUNET_PeerIdentity *peer;
struct CadetPeerPath *p;
unsigned int own_pos;
int i;
+ peers[0] = my_full_id;
LOG (GNUNET_ERROR_TYPE_DEBUG, " GET has %d hops.\n", get_path_length);
for (i = 0 ; i < get_path_length; i++)
{
peer = &get_path[get_path_length - i - 1];
LOG (GNUNET_ERROR_TYPE_DEBUG, " From GET: %s\n", GNUNET_i2s (peer));
- peers[i] = *peer;
+ peers[i + 1] = *peer;
}
for (i = 0 ; i < put_path_length; i++)
{
peer = &put_path[put_path_length - i - 1];
LOG (GNUNET_ERROR_TYPE_DEBUG, " From PUT: %s\n", GNUNET_i2s (peer));
- peers[i + get_path_length] = *peer;
+ peers[i + get_path_length + 1] = *peer;
}
p = path_build_from_peer_ids (peers, size, myid, &own_pos);
return p;