mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 15:30:11 +01:00
lldp: fix parsing of vlan-name attribute
We used to read 3 bytes after the TLV, fix this. Also, check that string length is at most 32 bytes as specified in figure E.3 of IEEE 802.1AB-2009. Fixes:18133ea142https://bugzilla.redhat.com/show_bug.cgi?id=1652210 (cherry picked from commite909778710) (cherry picked from commit05c27c3c50) (cherry picked from commit6d4ad477b8) (cherry picked from commitb97d38e579) (cherry picked from commit73b572e001) (cherry picked from commitd8c41cd8b0) (cherry picked from commit7408264674)
This commit is contained in:
parent
ba3f905c44
commit
bbc13c5bb6
2 changed files with 5 additions and 4 deletions
|
|
@ -515,11 +515,13 @@ lldp_neighbor_new (sd_lldp_neighbor *neighbor_sd, GError **error)
|
|||
l = data8[2];
|
||||
if (len != 3 + l)
|
||||
continue;
|
||||
if (l > 32)
|
||||
continue;
|
||||
|
||||
_lldp_attr_set_uint32 (neigh->attrs, LLDP_ATTR_ID_IEEE_802_1_VID,
|
||||
_access_uint16 (&data8[0]));
|
||||
_lldp_attr_set_str_ptr (neigh->attrs, LLDP_ATTR_ID_IEEE_802_1_VLAN_NAME,
|
||||
&data8[3], len);
|
||||
&data8[3], l);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -222,11 +222,10 @@ TEST_RECV_FRAME_DEFINE (_test_recv_data1_frame0,
|
|||
0x01, 0xe8,
|
||||
0xfe, 0x07, 0x00, 0x80, 0xc2, 0x02, /* IEEE 802.1 - Port and Protocol VLAN ID */
|
||||
0x01, 0x00, 0x00,
|
||||
0xfe, 0x17, 0x00, 0x80, 0xc2, 0x03, /* IEEE 802.1 - VLAN Name */
|
||||
0x01, 0xe8, 0x10, 0x76, 0x32, 0x2d,
|
||||
0xfe, 0x16, 0x00, 0x80, 0xc2, 0x03, /* IEEE 802.1 - VLAN Name */
|
||||
0x01, 0xe8, 0x0f, 0x76, 0x32, 0x2d,
|
||||
0x30, 0x34, 0x38, 0x38, 0x2d, 0x30,
|
||||
0x33, 0x2d, 0x30, 0x35, 0x30, 0x35,
|
||||
0x00,
|
||||
0xfe, 0x05, 0x00, 0x80, 0xc2, 0x04, /* IEEE 802.1 - Protocol Identity */
|
||||
0x00,
|
||||
0x00, 0x00 /* End of LLDPDU */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue