]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Read all notifications in lldpctl_recv. 286/head
authorGustav Wiklander <gustavwi@axis.com>
Wed, 13 Jun 2018 09:35:15 +0000 (11:35 +0200)
committerGustav Wiklander <gustavwi@axis.com>
Wed, 13 Jun 2018 09:35:15 +0000 (11:35 +0200)
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

index 591d9e9460c5db6cd070e4f5781b68edb8691083..88bbc99906505f8aabb49e5406451a9ea8b2b86c 100644 (file)
@@ -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);