From: Guus Sliepen Date: Wed, 27 May 2020 19:09:00 +0000 (+0200) Subject: Fix reception of a trailing, zero-length frame. X-Git-Url: http://git.meshlink.io/?a=commitdiff_plain;ds=sidebyside;h=933047eadd101bddb3646ad7acbc0e48170049a0;p=meshlink Fix reception of a trailing, zero-length frame. If the last (or only) frame received on a framed UDP channel had zero length, we would not send it to the application, but keep it in the receive buffer until more frames had been received. --- diff --git a/src/utcp.c b/src/utcp.c index d068d45b..00e02f6e 100644 --- a/src/utcp.c +++ b/src/utcp.c @@ -1444,11 +1444,11 @@ static void handle_unreliable_framed(struct utcp_connection *c, const struct hdr buffer_clear(&c->rcvbuf); // Handle whole frames - while(left > 2) { + while(left >= 2) { uint16_t framelen; memcpy(&framelen, ptr, sizeof(framelen)); - if(left <= (size_t)framelen + 2) { + if(left < (size_t)framelen + 2) { break; }