The use of ofpbuf_use_data() would allow someone to change the
code to modify the buffer, which consequently would lead to memory
allocations.  Since there are no ofpbuf_uninit() calls in place
that might invite a future bug.

Let's make use of ofpbuf_use_const() instead.

Fixes: 91fc51106cfe ("route-table: Support parsing multipath routes.")
Signed-off-by: Frode Nordahl <[email protected]>
---
 lib/route-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/route-table.c b/lib/route-table.c
index 7168ecf9e..d9b51931e 100644
--- a/lib/route-table.c
+++ b/lib/route-table.c
@@ -430,7 +430,7 @@ route_table_parse__(struct ofpbuf *buf, size_t ofs,
                 struct rtnexthop *mp_rtnh;
                 struct ofpbuf mp_buf;
 
-                ofpbuf_use_data(&mp_buf, nla, nla->nla_len);
+                ofpbuf_use_const(&mp_buf, nla, nla->nla_len);
                 mp_rtnh = ofpbuf_try_pull(&mp_buf, sizeof *mp_rtnh);
 
                 if (!mp_rtnh) {
-- 
2.43.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to