From db3731d0a6df6939a29c9bf80522a25d4edb8f11 Mon Sep 17 00:00:00 2001 From: Gustav Wiklander Date: Wed, 13 Jun 2018 11:35:15 +0200 Subject: [PATCH] Read all notifications in lldpctl_recv. Can otherwise lead to unbounded growth in input_buffer if lldp devices send notifications simultaneously thus a socket callback contains multiple notifications and only the first one is cleared. This leads to continous growth of the input buffer and will crash the system. Change-Id: I3331de2d8201f574a91b8e8f2d51a98010f7a7ab --- src/lib/connection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/connection.c b/src/lib/connection.c index 591d9e94..88bbc999 100644 --- a/src/lib/connection.c +++ b/src/lib/connection.c @@ -253,8 +253,8 @@ lldpctl_recv(lldpctl_conn_t *conn, const uint8_t *data, size_t length) memcpy(conn->input_buffer + conn->input_buffer_len, data, length); conn->input_buffer_len += length; - /* Is it a notification? */ - check_for_notification(conn); + /* Read all notifications */ + while(!check_for_notification(conn)); RESET_ERROR(conn); -- 2.39.5