aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-06-25 21:08:55 +0000
committerChristian Grothoff <christian@grothoff.org>2010-06-25 21:08:55 +0000
commit537903a8dc4c3ecf2dfa382af0289ddf890adfc7 (patch)
tree93e448c15c843861bd5dfe86c7cad3245abedfe7 /src/transport/transport_api.c
parent2b61888a0bf1d41b2b25256ca9834c3040551ce9 (diff)
downloadgnunet-537903a8dc4c3ecf2dfa382af0289ddf890adfc7.tar.gz
gnunet-537903a8dc4c3ecf2dfa382af0289ddf890adfc7.zip
fixing common off-by-one error with respect to maximum message size
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r--src/transport/transport_api.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index 2cd563178..d76ff6e5d 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -598,6 +598,7 @@ transport_notify_ready (void *cls, size_t size, void *buf)
598#endif 598#endif
599 if (mret != 0) 599 if (mret != 0)
600 { 600 {
601 GNUNET_assert (mret + sizeof (struct OutboundMessage) < GNUNET_SERVER_MAX_MESSAGE_SIZE);
601 obm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND); 602 obm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND);
602 obm.header.size = htons (mret + sizeof (struct OutboundMessage)); 603 obm.header.size = htons (mret + sizeof (struct OutboundMessage));
603 obm.priority = htonl (th->priority); 604 obm.priority = htonl (th->priority);
@@ -1699,7 +1700,7 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle
1699#if DEBUG_TRANSPORT 1700#if DEBUG_TRANSPORT
1700 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1701 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1701 "Message size is %d, max allowed is %d.\n", 1702 "Message size is %d, max allowed is %d.\n",
1702 size + sizeof (struct OutboundMessage), GNUNET_SERVER_MAX_MESSAGE_SIZE); 1703 size + sizeof (struct OutboundMessage), GNUNET_SERVER_MAX_MESSAGE_SIZE - 1);
1703#endif 1704#endif
1704 GNUNET_break (0); 1705 GNUNET_break (0);
1705 return NULL; 1706 return NULL;