Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: Fix longstanding snmp coverity issue #14465

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions zebra/zebra_snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ static void get_fwtable_route_node(struct variable *v, oid objid[],
if (policy) /* Not supported (yet?) */
return;
for (*np = route_top(table); *np; *np = route_next(*np)) {
if (!in_addr_cmp(&(*np)->p.u.prefix,
if (!in_addr_cmp((uint8_t *)&(*np)->p.u.prefix4,
(uint8_t *)&dest)) {
RNODE_FOREACH_RE (*np, *re) {
if (!in_addr_cmp((uint8_t *)&(*re)->nhe
Expand All @@ -374,13 +374,14 @@ static void get_fwtable_route_node(struct variable *v, oid objid[],
for (np2 = route_top(table); np2; np2 = route_next(np2)) {

/* Check destination first */
if (in_addr_cmp(&np2->p.u.prefix, (uint8_t *)&dest) > 0)
if (in_addr_cmp((uint8_t *)&np2->p.u.prefix4,
(uint8_t *)&dest) > 0)
RNODE_FOREACH_RE (np2, re2) {
check_replace(np2, re2, np, re);
}

if (in_addr_cmp(&np2->p.u.prefix, (uint8_t *)&dest)
== 0) { /* have to look at each re individually */
if (in_addr_cmp((uint8_t *)&np2->p.u.prefix4, (uint8_t *)&dest) ==
0) { /* have to look at each re individually */
RNODE_FOREACH_RE (np2, re2) {
int proto2, policy2;

Expand Down