diff options
Diffstat (limited to 'src/regex/gnunet-service-regex.c')
-rw-r--r-- | src/regex/gnunet-service-regex.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c index 7a5cc1f05..deaa6112e 100644 --- a/src/regex/gnunet-service-regex.c +++ b/src/regex/gnunet-service-regex.c | |||
@@ -196,9 +196,9 @@ handle_announce (void *cls, | |||
196 | static void | 196 | static void |
197 | handle_search_result (void *cls, | 197 | handle_search_result (void *cls, |
198 | const struct GNUNET_PeerIdentity *id, | 198 | const struct GNUNET_PeerIdentity *id, |
199 | const struct GNUNET_PeerIdentity *get_path, | 199 | const struct GNUNET_DHT_PathElement *get_path, |
200 | unsigned int get_path_length, | 200 | unsigned int get_path_length, |
201 | const struct GNUNET_PeerIdentity *put_path, | 201 | const struct GNUNET_DHT_PathElement *put_path, |
202 | unsigned int put_path_length) | 202 | unsigned int put_path_length) |
203 | { | 203 | { |
204 | struct ClientEntry *ce = cls; | 204 | struct ClientEntry *ce = cls; |
@@ -209,15 +209,15 @@ handle_search_result (void *cls, | |||
209 | 209 | ||
210 | if ((get_path_length >= 65536) || | 210 | if ((get_path_length >= 65536) || |
211 | (put_path_length >= 65536) || | 211 | (put_path_length >= 65536) || |
212 | ( ((get_path_length + put_path_length) * sizeof(struct | 212 | ( ((get_path_length + put_path_length) |
213 | GNUNET_PeerIdentity)) | 213 | * sizeof(struct GNUNET_PeerIdentity)) |
214 | + sizeof(struct ResultMessage) >= GNUNET_MAX_MESSAGE_SIZE) ) | 214 | + sizeof(struct ResultMessage) >= GNUNET_MAX_MESSAGE_SIZE) ) |
215 | { | 215 | { |
216 | GNUNET_break (0); | 216 | GNUNET_break (0); |
217 | return; | 217 | return; |
218 | } | 218 | } |
219 | size = (get_path_length + put_path_length) * sizeof(struct | 219 | size = (get_path_length + put_path_length) |
220 | GNUNET_PeerIdentity); | 220 | * sizeof(struct GNUNET_PeerIdentity); |
221 | env = GNUNET_MQ_msg_extra (result, | 221 | env = GNUNET_MQ_msg_extra (result, |
222 | size, | 222 | size, |
223 | GNUNET_MESSAGE_TYPE_REGEX_RESULT); | 223 | GNUNET_MESSAGE_TYPE_REGEX_RESULT); |
@@ -225,12 +225,10 @@ handle_search_result (void *cls, | |||
225 | result->put_path_length = htons ((uint16_t) put_path_length); | 225 | result->put_path_length = htons ((uint16_t) put_path_length); |
226 | result->id = *id; | 226 | result->id = *id; |
227 | gp = &result->id; | 227 | gp = &result->id; |
228 | GNUNET_memcpy (&gp[1], | 228 | for (unsigned int i = 0; i<get_path_length; i++) |
229 | get_path, | 229 | gp[i + 1] = get_path[i].pred; |
230 | get_path_length * sizeof(struct GNUNET_PeerIdentity)); | 230 | for (unsigned int i = 0; i<put_path_length; i++) |
231 | GNUNET_memcpy (&gp[1 + get_path_length], | 231 | gp[i + get_path_length + 1] = put_path[i].pred; |
232 | put_path, | ||
233 | put_path_length * sizeof(struct GNUNET_PeerIdentity)); | ||
234 | GNUNET_MQ_send (ce->mq, | 232 | GNUNET_MQ_send (ce->mq, |
235 | env); | 233 | env); |
236 | } | 234 | } |