Skip to content

Commit

Permalink
bgpd: fix bad bounds check for addpath in nlri
Browse files Browse the repository at this point in the history
If a peer advertised capability addpath in their OPEN, but sent us an
UPDATE without an ADDPATH, we overflow a heap buffer.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
  • Loading branch information
qlyoung committed Jan 16, 2020
1 parent d8a9566 commit 61dad26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -4465,7 +4465,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
if (addpath_encoded) {

/* When packet overflow occurs return immediately. */
if (pnt + BGP_ADDPATH_ID_LEN > lim)
if (pnt + BGP_ADDPATH_ID_LEN >= lim)
return BGP_NLRI_PARSE_ERROR_PACKET_OVERFLOW;

memcpy(&addpath_id, pnt, BGP_ADDPATH_ID_LEN);
Expand Down

0 comments on commit 61dad26

Please sign in to comment.