aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2023-04-27 18:06:58 +0200
committert3sserakt <t3ss@posteo.de>2023-05-02 12:41:01 +0200
commit4af328381f1e954c90e9b821e366998808394d88 (patch)
tree0515976c49303ffce9260fd9048e97a5e578be08
parent2f3c96abf15d8e1c6851e64a590c3c0eb208431e (diff)
downloadgnunet-4af328381f1e954c90e9b821e366998808394d88.tar.gz
gnunet-4af328381f1e954c90e9b821e366998808394d88.zip
TNG: Fixed bug in calculation of subtree fragment message size.
-rw-r--r--src/transport/gnunet-service-tng.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index ed4be7e88..c30d2dd19 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -9332,6 +9332,7 @@ fragment_message (struct Queue *queue,
9332 struct PendingAcknowledgement *pa; 9332 struct PendingAcknowledgement *pa;
9333 struct PendingMessage *ff; 9333 struct PendingMessage *ff;
9334 uint16_t mtu; 9334 uint16_t mtu;
9335 uint16_t msize;
9335 9336
9336 mtu = (UINT16_MAX == queue->mtu) 9337 mtu = (UINT16_MAX == queue->mtu)
9337 ? UINT16_MAX - sizeof(struct GNUNET_TRANSPORT_SendMessageTo) 9338 ? UINT16_MAX - sizeof(struct GNUNET_TRANSPORT_SendMessageTo)
@@ -9359,13 +9360,16 @@ fragment_message (struct Queue *queue,
9359 enough 9360 enough
9360 */ 9361 */
9361 ff = pm; 9362 ff = pm;
9363 msize = ff->bytes_msg;
9364
9362 while (((ff->bytes_msg > mtu) || (pm == ff)) && 9365 while (((ff->bytes_msg > mtu) || (pm == ff)) &&
9363 (ff->frag_off == ff->bytes_msg) && (NULL != ff->head_frag)) 9366 (ff->frag_off == msize) && (NULL != ff->head_frag))
9364 { 9367 {
9365 ff = ff->head_frag; /* descent into fragmented fragments */ 9368 ff = ff->head_frag; /* descent into fragmented fragments */
9369 msize = ff->bytes_msg - sizeof(struct TransportFragmentBoxMessage);
9366 } 9370 }
9367 9371
9368 if (((ff->bytes_msg > mtu) || (pm == ff)) && (ff->frag_off < ff->bytes_msg)) 9372 if (((ff->bytes_msg > mtu) || (pm == ff)) && (ff->frag_off < msize))
9369 { 9373 {
9370 /* Did not yet calculate all fragments, calculate next fragment */ 9374 /* Did not yet calculate all fragments, calculate next fragment */
9371 struct PendingMessage *frag; 9375 struct PendingMessage *frag;