Skip to content

Commit

Permalink
route-table: Use ofpbuf_use_const() for multipath attributes.
Browse files Browse the repository at this point in the history
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: 91fc511 ("route-table: Support parsing multipath routes.")
Signed-off-by: Frode Nordahl <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
fnordahl authored and igsilya committed Jan 21, 2025
1 parent be5b465 commit a3c06c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/route-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a3c06c3

Please sign in to comment.