
< len += frag->data_len;
---
> len = (len + frag->data_len <= MAX_PACKET_SIZE) ? 
>       len + frag->data_len : MAX_PACKET_SIZE;
