Skip to content

Commit

Permalink
netfilter: flowtable: fix NAT IPv6 offload mangling
Browse files Browse the repository at this point in the history
Fix out-of-bound access in the address array.

Fixes: 5c27d8d ("netfilter: nf_flow_table_offload: add IPv6 support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
ummakynes committed Mar 30, 2021
1 parent 9adc89a commit 0e07e25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/netfilter/nf_flow_table_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,12 @@ static void flow_offload_ipv6_mangle(struct nf_flow_rule *flow_rule,
const __be32 *addr, const __be32 *mask)
{
struct flow_action_entry *entry;
int i;
int i, j;

for (i = 0; i < sizeof(struct in6_addr) / sizeof(u32); i += sizeof(u32)) {
for (i = 0, j = 0; i < sizeof(struct in6_addr) / sizeof(u32); i += sizeof(u32), j++) {
entry = flow_action_entry_next(flow_rule);
flow_offload_mangle(entry, FLOW_ACT_MANGLE_HDR_TYPE_IP6,
offset + i, &addr[i], mask);
offset + i, &addr[j], mask);
}
}

Expand Down

0 comments on commit 0e07e25

Please sign in to comment.