aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
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,
119 const struct GNUNET_PeerIdentity *put_path, 119 const struct GNUNET_PeerIdentity *put_path,
120 unsigned int put_path_length) 120 unsigned int put_path_length)
121{ 121{
122 size_t size = get_path_length + put_path_length; 122 size_t size = get_path_length + put_path_length + 1;
123 struct GNUNET_PeerIdentity peers[size]; 123 struct GNUNET_PeerIdentity peers[size];
124 const struct GNUNET_PeerIdentity *peer; 124 const struct GNUNET_PeerIdentity *peer;
125 struct CadetPeerPath *p; 125 struct CadetPeerPath *p;
126 unsigned int own_pos; 126 unsigned int own_pos;
127 int i; 127 int i;
128 128
129 peers[0] = my_full_id;
129 LOG (GNUNET_ERROR_TYPE_DEBUG, " GET has %d hops.\n", get_path_length); 130 LOG (GNUNET_ERROR_TYPE_DEBUG, " GET has %d hops.\n", get_path_length);
130 for (i = 0 ; i < get_path_length; i++) 131 for (i = 0 ; i < get_path_length; i++)
131 { 132 {
132 peer = &get_path[get_path_length - i - 1]; 133 peer = &get_path[get_path_length - i - 1];
133 LOG (GNUNET_ERROR_TYPE_DEBUG, " From GET: %s\n", GNUNET_i2s (peer)); 134 LOG (GNUNET_ERROR_TYPE_DEBUG, " From GET: %s\n", GNUNET_i2s (peer));
134 peers[i] = *peer; 135 peers[i + 1] = *peer;
135 } 136 }
136 for (i = 0 ; i < put_path_length; i++) 137 for (i = 0 ; i < put_path_length; i++)
137 { 138 {
138 peer = &put_path[put_path_length - i - 1]; 139 peer = &put_path[put_path_length - i - 1];
139 LOG (GNUNET_ERROR_TYPE_DEBUG, " From PUT: %s\n", GNUNET_i2s (peer)); 140 LOG (GNUNET_ERROR_TYPE_DEBUG, " From PUT: %s\n", GNUNET_i2s (peer));
140 peers[i + get_path_length] = *peer; 141 peers[i + get_path_length + 1] = *peer;
141 } 142 }
142 p = path_build_from_peer_ids (peers, size, myid, &own_pos); 143 p = path_build_from_peer_ids (peers, size, myid, &own_pos);
143 return p; 144 return p;