From bfdde400319adc286544b0088be8bf1d40180fb7 Mon Sep 17 00:00:00 2001 From: Lorenzo Cogotti Date: Mon, 18 Oct 2021 11:45:17 +0200 Subject: [PATCH] [lonetix/bgp] Check for AGGREGATOR4 presence before checking its correctness --- lonetix/bgp/attribute.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lonetix/bgp/attribute.c b/lonetix/bgp/attribute.c index 1a4e934..0228cad 100644 --- a/lonetix/bgp/attribute.c +++ b/lonetix/bgp/attribute.c @@ -547,13 +547,15 @@ Bgpattr *Bgp_GetRealAggregator(const Bgpattrseg *tpa, if (Bgp_GetErrStat(NULL)) return NULL; // forward error - if (!BGP_CHKAGGRSIZ(attr4, TRUE)) { - Bgp_SetErrStat(BGPEBADAGGR4); - return NULL; - } + if (attr4) { + if (!BGP_CHKAGGRSIZ(attr4, TRUE)) { + Bgp_SetErrStat(BGPEBADAGGR4); + return NULL; + } - attr = attr4; - asn32bit = TRUE; + attr = attr4; + asn32bit = TRUE; + } } *isAsn32bit = asn32bit;