From 629d84f512c017077f3b4e16b2a00492ed1762ff Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Fri, 3 Feb 2023 09:41:41 +0100 Subject: [PATCH] bgpd: fix dereference of null pointer in bgp_attr_aspath The peer pointer theorically have a NULL bgp pointer. This triggers a SA issue. So let us fix it. Signed-off-by: Philippe Guibert --- bgpd/bgp_attr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index eb1b208d9b..e79c7a4d38 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -1633,7 +1633,8 @@ static int bgp_attr_aspath(struct bgp_attr_parser_args *args) * such messages, conformant BGP speakers SHOULD use the "Treat-as- * withdraw" error handling behavior as per [RFC7606]. */ - if (peer->bgp->reject_as_sets && aspath_check_as_sets(attr->aspath)) { + if (peer->bgp && peer->bgp->reject_as_sets && + aspath_check_as_sets(attr->aspath)) { flog_err(EC_BGP_ATTR_MAL_AS_PATH, "AS_SET and AS_CONFED_SET are deprecated from %pBP", peer);