]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix bad bounds check for addpath in nlri
authorQuentin Young <qlyoung@cumulusnetworks.com>
Sun, 24 Nov 2019 07:02:54 +0000 (02:02 -0500)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Sun, 24 Nov 2019 07:48:11 +0000 (02:48 -0500)
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>
bgpd/bgp_route.c

index fb2eb10dd931fef3ff69c3094d8910884232730f..71411df6eaca9b51f902ec182c144b350a4bb84f 100644 (file)
@@ -4481,7 +4481,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;
 
                        addpath_id = ntohl(*((uint32_t *)pnt));