diff options
Diffstat (limited to 'src/ats/gnunet-service-ats_scheduling.c')
-rw-r--r-- | src/ats/gnunet-service-ats_scheduling.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c index 2491529db..9eebe2c3e 100644 --- a/src/ats/gnunet-service-ats_scheduling.c +++ b/src/ats/gnunet-service-ats_scheduling.c | |||
@@ -258,7 +258,10 @@ GAS_handle_address_update (void *cls, struct GNUNET_SERVER_Client *client, | |||
258 | plugin_name_length = ntohs (m->plugin_name_length); | 258 | plugin_name_length = ntohs (m->plugin_name_length); |
259 | atsi = (const struct GNUNET_TRANSPORT_ATS_Information*) &m[1]; | 259 | atsi = (const struct GNUNET_TRANSPORT_ATS_Information*) &m[1]; |
260 | address = (const char*) &atsi[ats_count]; | 260 | address = (const char*) &atsi[ats_count]; |
261 | plugin_name = &address[address_length]; | 261 | if (plugin_name_length != 0) |
262 | plugin_name = &address[address_length]; | ||
263 | else | ||
264 | plugin_name = ""; | ||
262 | if ( (address_length + | 265 | if ( (address_length + |
263 | plugin_name_length + | 266 | plugin_name_length + |
264 | ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) + | 267 | ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) + |
@@ -302,10 +305,10 @@ GAS_handle_address_destroyed (void *cls, struct GNUNET_SERVER_Client *client, | |||
302 | uint16_t size; | 305 | uint16_t size; |
303 | 306 | ||
304 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 307 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
305 | "Received `%s' message\n", | 308 | "Received `%s' message of size %u %u\n", |
306 | "ADDRESS_DESTROYED"); | 309 | "ADDRESS_DESTROYED", ntohs (message->size), sizeof (struct AddressDestroyedMessage)); |
307 | size = ntohs (message->size); | 310 | size = ntohs (message->size); |
308 | if (size <= sizeof (struct AddressDestroyedMessage)) | 311 | if (size < sizeof (struct AddressDestroyedMessage)) |
309 | { | 312 | { |
310 | GNUNET_break (0); | 313 | GNUNET_break (0); |
311 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 314 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
@@ -316,16 +319,28 @@ GAS_handle_address_destroyed (void *cls, struct GNUNET_SERVER_Client *client, | |||
316 | address_length = ntohs (m->address_length); | 319 | address_length = ntohs (m->address_length); |
317 | plugin_name_length = ntohs (m->plugin_name_length); | 320 | plugin_name_length = ntohs (m->plugin_name_length); |
318 | address = (const char*) &m[1]; | 321 | address = (const char*) &m[1]; |
319 | plugin_name = &address[address_length]; | 322 | if (plugin_name_length != 0) |
323 | plugin_name = &address[address_length]; | ||
324 | else | ||
325 | plugin_name = ""; | ||
326 | |||
320 | if ( (address_length + | 327 | if ( (address_length + |
321 | plugin_name_length + | 328 | plugin_name_length + |
322 | sizeof (struct AddressDestroyedMessage) != ntohs (message->size)) || | 329 | sizeof (struct AddressDestroyedMessage) != ntohs (message->size))) |
323 | (plugin_name[plugin_name_length - 1] != '\0') ) | ||
324 | { | 330 | { |
325 | GNUNET_break (0); | 331 | GNUNET_break (0); |
326 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 332 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
327 | return; | 333 | return; |
328 | } | 334 | } |
335 | |||
336 | if (plugin_name_length != 0) | ||
337 | if (plugin_name[plugin_name_length - 1] != '\0') | ||
338 | { | ||
339 | GNUNET_break (0); | ||
340 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
341 | return; | ||
342 | } | ||
343 | |||
329 | GAS_address_destroyed (&m->peer, | 344 | GAS_address_destroyed (&m->peer, |
330 | plugin_name, | 345 | plugin_name, |
331 | address, | 346 | address, |