2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 09:58:01 +00:00

route-table: Avoid potential NULL ptr dereference.

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: 0b8da9ae1f38 ("route: support IPv6 and use IPv4-mapped addresses")
Fixes: 71785737ded2 ("route-table: Split header and attribute parsing.")
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Frode Nordahl <fnordahl@ubuntu.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Frode Nordahl 2025-01-20 13:43:06 +00:00 committed by Ilya Maximets
parent e16db12308
commit f74777da0b

View File

@ -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);
}