Skip to content

bgpd: fix integer overflow in maximum prefix threshold check - #22439

Merged
riw777 merged 1 commit into
FRRouting:masterfrom
guoguojia2021:fix/bgpd-pmax-threshold-overflow
Jun 23, 2026
Merged

bgpd: fix integer overflow in maximum prefix threshold check#22439
riw777 merged 1 commit into
FRRouting:masterfrom
guoguojia2021:fix/bgpd-pmax-threshold-overflow

bgpd: fix integer overflow in maximum prefix threshold check

a2ae427
Select commit
Loading
Failed to load commit list.
frrbot / frrbot completed Jun 23, 2026 in 9s

Style and/or linter errors found

Style and/or linter errors found

Details

Thanks for your contribution to FRR!

Click for style suggestions

diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index fe33096601..eba4ce428d 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -5361,8 +5361,7 @@ bool bgp_maximum_prefix_overflow(struct peer *peer, afi_t afi, safi_t safi,
 		UNSET_FLAG(peer->af_sflags[afi][safi],
 			   PEER_STATUS_PREFIX_LIMIT);
 
-	if (pcount
-	    > ((uint64_t)peer->pmax[afi][safi] * peer->pmax_threshold[afi][safi] / 100)) {
+	if (pcount > ((uint64_t)peer->pmax[afi][safi] * peer->pmax_threshold[afi][safi] / 100)) {
 		if (CHECK_FLAG(peer->af_sflags[afi][safi],
 			       PEER_STATUS_PREFIX_THRESHOLD)
 		    && !always)

To apply the style suggestions:

curl https://gist.githubusercontent.com/polychaeta/15d8df67ac83a363a7a14598a3593c9f/raw/bf7e03f4a636bbb3604266e4fe408d4070499639/style.diff | git apply -

If you are a new contributor to FRR, please see our contributing guidelines.

After making changes, you do not need to create a new PR. You should perform an amend or interactive rebase followed by a force push.