summaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-tng.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-11-29 22:26:21 +0100
committerChristian Grothoff <christian@grothoff.org>2018-11-29 22:26:21 +0100
commite871f8368c8a1f0867f68f656875e4c37c26f298 (patch)
treec2aa6a2b40213d695e8f047a51695563f44d74b8 /src/transport/gnunet-service-tng.c
parentf8bccfbb602bdbed4bcc00fd3c6c3a00add82416 (diff)
finish (?) libgnunetatstransport for now
Diffstat (limited to 'src/transport/gnunet-service-tng.c')
-rw-r--r--src/transport/gnunet-service-tng.c38
1 files changed, 3 insertions, 35 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index b184a0600..feaa0cfff 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -1078,7 +1078,6 @@ check_communicator_available (void *cls,
const struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam)
{
struct TransportClient *tc = cls;
- const char *addr;
uint16_t size;
if (CT_NONE != tc->type)
@@ -1090,12 +1089,7 @@ check_communicator_available (void *cls,
size = ntohs (cam->header.size) - sizeof (*cam);
if (0 == size)
return GNUNET_OK; /* receive-only communicator */
- addr = (const char *) &cam[1];
- if ('\0' != addr[size-1])
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
+ GNUNET_MQ_check_zero_termination (cam);
return GNUNET_OK;
}
@@ -1135,26 +1129,13 @@ check_add_address (void *cls,
const struct GNUNET_TRANSPORT_AddAddressMessage *aam)
{
struct TransportClient *tc = cls;
- const char *addr;
- uint16_t size;
if (CT_COMMUNICATOR != tc->type)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
- size = ntohs (aam->header.size) - sizeof (*aam);
- if (0 == size)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- addr = (const char *) &aam[1];
- if ('\0' != addr[size-1])
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
+ GNUNET_MQ_check_zero_termination (aam);
return GNUNET_OK;
}
@@ -1363,26 +1344,13 @@ check_add_queue_message (void *cls,
const struct GNUNET_TRANSPORT_AddQueueMessage *aqm)
{
struct TransportClient *tc = cls;
- const char *addr;
- uint16_t size;
if (CT_COMMUNICATOR != tc->type)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
- size = ntohs (aqm->header.size) - sizeof (*aqm);
- if (0 == size)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- addr = (const char *) &aqm[1];
- if ('\0' != addr[size-1])
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
+ GNUNET_MQ_check_zero_termination (aqm);
return GNUNET_OK;
}