From 933047eadd101bddb3646ad7acbc0e48170049a0 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Wed, 27 May 2020 21:09:00 +0200 Subject: [PATCH] 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. --- src/utcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } -- 2.39.2