Smallers steps to keep plugin running
[oweals/gnunet.git] / src / dv / dv_api.c
index dfc5a0fe9b5d035d50414204ebb116e7b739beb0..d9aef03c86f85b00cc62c7f789f1e4ddb15ee4f2 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -209,7 +209,7 @@ finish (struct GNUNET_DV_Handle *handle, int code)
  *
  * @param cls handle to the dv service (struct GNUNET_DV_Handle)
  * @param size how many bytes can we send
- * @buf where to copy the message to send
+ * @param buf where to copy the message to send
  *
  * @return how many bytes we copied to buf
  */
@@ -367,9 +367,8 @@ void handle_message_receipt (void *cls,
 
     received_msg = (struct GNUNET_DV_MessageReceived *)msg;
     packed_msg_len = ntohl(received_msg->msg_len);
-    sender_address_len = ntohl(received_msg->sender_address_len);
-
-    GNUNET_assert(ntohs(msg->size) == (sizeof(struct GNUNET_DV_MessageReceived) + packed_msg_len + sender_address_len));
+    sender_address_len = ntohs(msg->size) - packed_msg_len - sizeof(struct GNUNET_DV_MessageReceived);
+    GNUNET_assert(sender_address_len > 0);
     sender_address = GNUNET_malloc(sender_address_len);
     memcpy(sender_address, &received_msg[1], sender_address_len);
     packed_msg_start = (char *)&received_msg[1];