Boston, MA 02111-1307, USA.
*/
/**
- * @file src/fragmentation/defragmentation_new.c
+ * @file src/fragmentation/defragmentation.c
* @brief library to help defragment messages
* @author Christian Grothoff
*/
}
fh = (const struct FragmentHeader*) msg;
msize = ntohs (fh->total_size);
+ if (msize < sizeof (struct GNUNET_MessageHeader))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
fid = ntohl (fh->fragment_id);
foff = ntohs (fh->offset);
if (foff >= msize)
return GNUNET_YES;
}
-/* end of defragmentation_new.c */
+/* end of defragmentation.c */
Boston, MA 02111-1307, USA.
*/
/**
- * @file src/fragmentation/fragmentation_new.c
+ * @file src/fragmentation/fragmentation.c
* @brief library to help fragment messages
* @author Christian Grothoff
*/
_("# messages fragmented"),
1, GNUNET_NO);
GNUNET_assert (mtu >= 1024 + sizeof (struct FragmentHeader));
- size = ntohs (msg->size);
+ size = ntohs (msg->size);
GNUNET_STATISTICS_update (stats,
_("# total size of fragmented messages"),
size, GNUNET_NO);
- //GNUNET_assert (size > mtu);
+ GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader));
fc = GNUNET_malloc (sizeof (struct GNUNET_FRAGMENT_Context) + size);
fc->stats = stats;
fc->mtu = mtu;
}
-/* end of fragmentation_new.c */
+/* end of fragmentation.c */
for (i=0;i<NUM_MSGS;i++)
{
msg->type = htons ((uint16_t) i);
- msg->size = htons ( 1 + (17 * i) % (32 * 1024));
+ msg->size = htons (sizeof (struct GNUNET_MessageHeader) + (17 * i) % (32 * 1024));
frags[i] = GNUNET_FRAGMENT_context_create (NULL /* no stats */,
MTU,
&trackers[i],