X-Git-Url: http://git.meshlink.io/?p=utcp;a=blobdiff_plain;f=utcp.c;fp=utcp.c;h=75d4f83417a3be30bccc6346757abef8f7643585;hp=fd507f91abecc9d674ab99c0cb47ef1d94b1f96e;hb=9809749c054e9beb9b01aa4e7e2f597871da133c;hpb=adbd21ef2be13e8d6ca329be012f702f2ba43c40 diff --git a/utcp.c b/utcp.c index fd507f9..75d4f83 100644 --- a/utcp.c +++ b/utcp.c @@ -1046,8 +1046,14 @@ static void handle_out_of_order(struct utcp_connection *c, uint32_t offset, cons // Packet loss or reordering occured. Store the data in the buffer. ssize_t rxd = buffer_put_at(&c->rcvbuf, offset, data, len); - if(rxd < 0 || (size_t)rxd < len) { - abort(); + if(rxd <= 0) { + debug(c, "packet outside receive buffer, dropping\n"); + return; + } + + if((size_t)rxd < len) { + debug(c, "packet partially outside receive buffer\n"); + len = rxd; } // Make note of where we put it. @@ -1169,10 +1175,6 @@ static void handle_incoming_data(struct utcp_connection *c, const struct hdr *hd uint32_t offset = seqdiff(hdr->seq, c->rcv.nxt); - if(offset + len > c->rcvbuf.maxsize) { - abort(); - } - if(offset) { handle_out_of_order(c, offset, data, len); } else {