Skip to content

Commit 57d0dc5

Browse files
committed
bgpd: fix insecure data write with area addresses
Fix an issue where an attacker may inject a tainted length value to corrupt the memory. > CID 1568380 (sonic-net#1 of 1): Untrusted value as argument (TAINTED_SCALAR) > 9. tainted_data: Passing tainted expression length to bgp_linkstate_nlri_value_display, which uses it as an offset Fixes: 8b531b1 ("bgpd: store and send bgp link-state attributes") Signed-off-by: Louis Scalbert <[email protected]>
1 parent 54222f9 commit 57d0dc5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

bgpd/bgp_linkstate_tlv.c

+5
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,11 @@ static void bgp_linkstate_tlv_isis_area_indentifier_display(struct vty *vty,
15281528
{
15291529
struct iso_address addr;
15301530

1531+
if (length > sizeof(addr.area_addr)) {
1532+
bgp_linkstate_tlv_hexa_display(vty, pnt, length, json);
1533+
return;
1534+
}
1535+
15311536
addr.addr_len = length;
15321537
memcpy(addr.area_addr, pnt, length);
15331538

0 commit comments

Comments
 (0)