commit 262926a53f2d8358695d12840a487c3e8e8c4599
parent 4812be40692ea16b71ba15d6703ea1ef524dffa1
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 22 Jan 2017 23:54:35 +0100
log precise error if we receive malformed data
Diffstat:
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/cadet/gnunet-service-cadet-new.c b/src/cadet/gnunet-service-cadet-new.c
@@ -632,10 +632,8 @@ check_data (void *cls,
/* FIXME: what is the format we shall allow for @a msg?
ONE payload item or multiple? Seems current cadet_api
at least in theory allows more than one. Next-gen
- cadet_api will likely no more.
-
- Regardless, the multi-message check below should pass,
- albeit it does not :-(. */
+ cadet_api will likely no more, so we could then
+ simplify this mess again. */
/* Sanity check for message size */
payload_size = ntohs (msg->header.size) - sizeof (*msg);
buf = (const char *) &msg[1];
@@ -650,7 +648,13 @@ check_data (void *cls,
(payload_claimed_size < sizeof (struct GNUNET_MessageHeader)) ||
(GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE < payload_claimed_size) )
{
- GNUNET_break_op (0);
+ GNUNET_break (0);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Local data of %u total size had sub-message %u at %u with %u bytes\n",
+ ntohs (msg->header.size),
+ ntohs (pa.type),
+ (unsigned int) (buf - (const char *) &msg[1]),
+ (unsigned int) payload_claimed_size);
return GNUNET_SYSERR;
}
payload_size -= payload_claimed_size;