From: jsg Date: Sat, 3 Feb 2024 09:26:52 +0000 (+0000) Subject: fix off-by-one in bounds check X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4b4f2e389e0467247322328a17fc360342fb97b8;p=openbsd fix off-by-one in bounds check found by "buffer overflow 'peer->capa.add_path' 7 <= 7" smatch error ok claudio@ --- diff --git a/usr.sbin/bgpd/rde_peer.c b/usr.sbin/bgpd/rde_peer.c index d8a25bfa8ec..84e952620ed 100644 --- a/usr.sbin/bgpd/rde_peer.c +++ b/usr.sbin/bgpd/rde_peer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_peer.c,v 1.34 2023/11/07 11:17:35 claudio Exp $ */ +/* $OpenBSD: rde_peer.c,v 1.35 2024/02/03 09:26:52 jsg Exp $ */ /* * Copyright (c) 2019 Claudio Jeker @@ -47,7 +47,7 @@ peer_has_as4byte(struct rde_peer *peer) int peer_has_add_path(struct rde_peer *peer, uint8_t aid, int mode) { - if (aid > AID_MAX) + if (aid >= AID_MAX) return 0; if (aid == AID_UNSPEC) { /* check if at capability is set for at least one AID */