more asserts for 1903
authorChristian Grothoff <christian@grothoff.org>
Tue, 15 Nov 2011 08:08:05 +0000 (08:08 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 15 Nov 2011 08:08:05 +0000 (08:08 +0000)
src/ats/ats_api_scheduling.c
src/ats/gnunet-service-ats_addresses.c
src/ats/gnunet-service-ats_scheduling.c

index 9991049796597e0c1417b8d8ce8780597d04c14c..ac4cca8824c6a62e66f5e7fe15dbbd0f59548c20 100644 (file)
@@ -822,8 +822,9 @@ GNUNET_ATS_address_destroyed (struct GNUNET_ATS_SchedulingHandle *sh,
   size_t msize;
   uint32_t session_id;
 
-  GNUNET_break (address->transport_name != NULL);
-  namelen = (address->transport_name == NULL) ? 0 : strlen (address->transport_name) + 1;
+  GNUNET_assert (address->transport_name != NULL);
+  namelen = strlen (address->transport_name) + 1;
+  GNUNET_assert (namelen > 1);
   msize = sizeof (struct AddressDestroyedMessage) + address->address_length + namelen;
   if ((msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
       (address->address_length >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
index ee76842b622eddfee86d5a092af4c5e6a699c961..f4f9607e624c547eaca64c8cc361f9c01d56647a 100644 (file)
@@ -348,6 +348,7 @@ GAS_addresses_destroy (const struct GNUNET_PeerIdentity *peer,
 {
   struct ATS_Address aa;
 
+  GNUNET_break (0 < strlen (plugin_name));
   aa.peer = *peer;
   aa.addr_len = plugin_addr_len;
   aa.addr = plugin_addr;
index dac84676f20bd2c675d2369ef6731603908922be..4659a2363222a356dad5d0198e9175ab660204ac 100644 (file)
@@ -359,8 +359,8 @@ GAS_handle_address_destroyed (void *cls, struct GNUNET_SERVER_Client *client,
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-  if ((plugin_name_length != 0) &&
-      (plugin_name[plugin_name_length - 1] != '\0'))
+  if ( (plugin_name_length == 0) ||
+       (plugin_name[plugin_name_length - 1] != '\0'))
   {
     GNUNET_break (0);
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);