Skip to content

Commit 9d3f027

Browse files
Ren Weiummakynes
authored andcommitted
netfilter: ip6t_rt: reject oversized addrnr in rt_mt6_check()
Reject rt match rules whose addrnr exceeds IP6T_RT_HOPS. rt_mt6() expects addrnr to stay within the bounds of rtinfo->addrs[]. Validate addrnr during rule installation so malformed rules are rejected before the match logic can use an out-of-range value. Fixes: 1da177e ("Linux-2.6.12-rc2") Reported-by: Yifan Wu <[email protected]> Reported-by: Juefei Pu <[email protected]> Co-developed-by: Yuan Tan <[email protected]> Signed-off-by: Yuan Tan <[email protected]> Suggested-by: Xin Liu <[email protected]> Tested-by: Yuhang Zheng <[email protected]> Signed-off-by: Ren Wei <[email protected]> Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 52025eb commit 9d3f027

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

net/ipv6/netfilter/ip6t_rt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ static int rt_mt6_check(const struct xt_mtchk_param *par)
157157
pr_debug("unknown flags %X\n", rtinfo->invflags);
158158
return -EINVAL;
159159
}
160+
if (rtinfo->addrnr > IP6T_RT_HOPS) {
161+
pr_debug("too many addresses specified\n");
162+
return -EINVAL;
163+
}
160164
if ((rtinfo->flags & (IP6T_RT_RES | IP6T_RT_FST_MASK)) &&
161165
(!(rtinfo->flags & IP6T_RT_TYP) ||
162166
(rtinfo->rt_type != 0) ||

0 commit comments

Comments
 (0)