Skip to content

Commit

Permalink
route-table: Avoid potential NULL ptr dereference.
Browse files Browse the repository at this point in the history
The gcc static analyzer pointed out a potential NULL pointer
dereference in route_table_parse().

While the probability is low, let's plug it.

Fixes: 0b8da9a ("route: support IPv6 and use IPv4-mapped addresses")
Fixes: 7178573 ("route-table: Split header and attribute parsing.")
Signed-off-by: Frode Nordahl <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
  • Loading branch information
fnordahl authored and ovsrobot committed Jan 20, 2025
1 parent caed64d commit ac75bd5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/route-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ route_table_parse(struct ofpbuf *buf, void *change)
nlmsg = ofpbuf_at(buf, 0, NLMSG_HDRLEN);
rtm = ofpbuf_at(buf, NLMSG_HDRLEN, sizeof *rtm);

if (!nlmsg || !rtm) {
return 0;
}

return route_table_parse__(buf, NLMSG_HDRLEN + sizeof *rtm,
nlmsg, rtm, NULL, change);
}
Expand Down

0 comments on commit ac75bd5

Please sign in to comment.