From: Gustav Wiklander Date: Wed, 13 Jun 2018 09:35:15 +0000 (+0200) Subject: Read all notifications in lldpctl_recv. X-Git-Tag: 1.0.2~17^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F286%2Fhead;p=thirdparty%2Flldpd.git 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 --- 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);