From 2b3d41493db016689f5485f03e50da4fc5895514 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 15 Nov 2024 08:14:32 +0200 Subject: [PATCH 1/2] Revert "bgpd: Fix color extended community parsing" This reverts commit 8e771bda840e189eed2851f63ad80cb1a235f40f. --- bgpd/bgp_ecommunity.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 5935028a59..065f4fef37 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -766,6 +766,8 @@ static const char *ecommunity_gettoken(const char *str, void *eval_ptr, if (*endptr != '\0' || tmp_as > BGP_AS4_MAX || errno) goto error; + if (*token == ecommunity_token_color && as > 3) + goto error; as = (as_t)tmp_as; } } else if (*p == '.') { From f765bc4144c0741b5427cc6f61af497170f28484 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 15 Nov 2024 08:16:10 +0200 Subject: [PATCH 2/2] bgpd: Use tmp_as when parsing color extended community as is not initialized and it's assigned only later. CID: 1601739 Fixes: 937cf4d ("bgpd:support of color extended community color-only types") Signed-off-by: Donatas Abraitis --- bgpd/bgp_ecommunity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 065f4fef37..e794ccb308 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -766,7 +766,7 @@ static const char *ecommunity_gettoken(const char *str, void *eval_ptr, if (*endptr != '\0' || tmp_as > BGP_AS4_MAX || errno) goto error; - if (*token == ecommunity_token_color && as > 3) + if (*token == ecommunity_token_color && tmp_as > 3) goto error; as = (as_t)tmp_as; }