From: Zbigniew Jędrzejewski-Szmek Date: Fri, 25 Dec 2015 05:38:05 +0000 (-0500) Subject: Merge pull request #2223 from ssahani/lldp X-Git-Tag: v229~192 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d790d8c1b23620aa6dfb4131c04b25dea426e1c1;p=thirdparty%2Fsystemd.git Merge pull request #2223 from ssahani/lldp Closes #2223. --- d790d8c1b23620aa6dfb4131c04b25dea426e1c1 diff --cc src/libsystemd-network/sd-lldp.c index d3ea74404b8,bb4314b967f..1c696f9ef07 --- a/src/libsystemd-network/sd-lldp.c +++ b/src/libsystemd-network/sd-lldp.c @@@ -299,6 -285,41 +285,41 @@@ int lldp_handle_packet(tlv_packet *tlv ttl = true; + break; + case LLDP_TYPE_SYSTEM_NAME: + + /* According to RFC 1035 the length of a FQDN is limited to 255 characters */ + if (len > 255) { - log_lldp("Received invalid systemd name length: %d. Dropping.", len); ++ log_lldp("Received invalid system name length: %d. Dropping.", len); + malformed = true; + goto out; + } + + if (system_name) { + log_lldp("Duplicate system name found. Dropping."); + malformed = true; + goto out; + } + + system_name = true; + + break; + case LLDP_TYPE_SYSTEM_DESCRIPTION: + + /* 0 <= n <= 255 octets */ + if (len > 255) { + log_lldp("Received invalid system description length: %d. Dropping.", len); + malformed = true; + goto out; + } + + if (system_description) { + log_lldp("Duplicate system description found. Dropping."); + malformed = true; + goto out; + } + + system_description = true; break; default: