From 9e5acccacb79d139fc8fcec5dafe12cfddb52edb Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 23 Apr 2024 11:39:29 +0200 Subject: [PATCH] Revert "bgpd: fix pointer arithmetic in bgp snmp module" This reverts commit d9bd9ebbf1c3ab902133e7f47c4b8c073e2df3d4. The previous code was correct even if the coverity scanner was complaining. Fixes: https://github.com/FRRouting/frr/issues/15680 Signed-off-by: Louis Scalbert (cherry picked from commit c1124a44c34f5fdce5fd06a6441ea78f8b5f352b) --- bgpd/bgp_snmp_bgp4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_snmp_bgp4.c b/bgpd/bgp_snmp_bgp4.c index 3d04dc2ece..755777c167 100644 --- a/bgpd/bgp_snmp_bgp4.c +++ b/bgpd/bgp_snmp_bgp4.c @@ -401,7 +401,7 @@ static struct bgp_path_info *bgp4PathAttrLookup(struct variable *v, oid name[], /* Set OID offset for prefix. */ offset = name + v->namelen; oid2in_addr(offset, IN_ADDR_SIZE, &addr->prefix); - offset++; + offset += IN_ADDR_SIZE; /* Prefix length. */ addr->prefixlen = *offset; @@ -497,7 +497,7 @@ static struct bgp_path_info *bgp4PathAttrLookup(struct variable *v, oid name[], offset = name + v->namelen; oid_copy_in_addr(offset, &rn_p->u.prefix4); - offset++; + offset += IN_ADDR_SIZE; *offset = rn_p->prefixlen; offset++; oid_copy_in_addr(offset, -- 2.39.5