fix
[oweals/gnunet.git] / src / core / core_api.c
index b597a74244958f70cf109071c6ad462d3a6c3b59..4672c7843ee6b4157c91069ba6794359659c16e6 100644 (file)
@@ -257,7 +257,7 @@ static void
 reconnect (struct GNUNET_CORE_Handle *h)
 {
   if (h->client_notifications != NULL)
-    GNUNET_CLIENT_disconnect (h->client_notifications);
+    GNUNET_CLIENT_disconnect (h->client_notifications, GNUNET_NO);
   h->currently_down = GNUNET_YES;
   h->client_notifications = GNUNET_CLIENT_connect (h->sched, "core", h->cfg);
   if (h->client_notifications == NULL)
@@ -793,7 +793,7 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle)
   if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel (handle->sched, handle->reconnect_task);
   if (handle->client_notifications != NULL)
-    GNUNET_CLIENT_disconnect (handle->client_notifications);
+    GNUNET_CLIENT_disconnect (handle->client_notifications, GNUNET_NO);
   GNUNET_free_non_null (handle->solicit_buffer);
   GNUNET_free (handle);
 }
@@ -854,6 +854,11 @@ produce_send (void *cls, size_t size, void *buf)
       return 0;
     }
   GNUNET_assert (dt >= sizeof (struct GNUNET_MessageHeader));
+  if (dt + sizeof (struct SendMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
+    {
+      GNUNET_break (0);
+      return 0;
+    }
   sm->header.size = htons (dt + sizeof (struct SendMessage));
   GNUNET_assert (dt + sizeof (struct SendMessage) <= size);
   return dt + sizeof (struct SendMessage);