fib: fix adj_get_rewrite() 10/42910/2
authorBenoît Ganne <[email protected]>
Tue, 29 Apr 2025 13:09:27 +0000 (15:09 +0200)
committerBenoit Ganne <[email protected]>
Wed, 7 May 2025 07:42:03 +0000 (07:42 +0000)
commit8bba4d3da1418ae4c82ec23d061076434ccf5931
tree13a00d0ecdb9b2e24a4bcbaccd2b085dd0f186b5
parenteca860c856c265089789f32e04e5c2b51594caf9
fib: fix adj_get_rewrite()

It looks like this bug has been around forever: initially the rewrite
string was at the end of rw->data, so the correct thing to do would have
been to return rw->data + max_size - rw->data_size.
Then we moved the rewrite string at the beginning of the buffer, so we
should always return rw->data.
In any case, rw->data - rw->data_size is clearly wrong and will access
memory in the rewrite header or before it.

Type: fix
Fixes: b80c536e34b610ca77cd84448754e4bd9c46cf68

Change-Id: Ib6d1124776a3c20e718fc46d61190dec7cba31c3
Signed-off-by: Benoît Ganne <[email protected]>
src/vnet/adj/adj.c