Skip to content

Commit dcc0353

Browse files
committed
Fixing a critical issue in MTU mismatch that may cause segfault
1 parent 0279432 commit dcc0353

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/rudp_lib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ int RUDP_Socket_p::recv(void *buffer, uint32_t buffer_size)
558558
RUDP_header *header = (RUDP_header *)packet;
559559
uint32_t packet_seq_num = ntohl(header->seq_num);
560560
uint16_t packet_size = ntohs(header->length);
561-
uint32_t offset = ntohl(header->seq_num) * (m_protocolMTU - sizeof(RUDP_header));
561+
uint32_t offset = ntohl(header->seq_num) * (std::min(m_protocolMTU, m_peersMTU) - sizeof(RUDP_header));
562562

563563
if (packet_seq_num == prev_seq_num)
564564
{

0 commit comments

Comments
 (0)