mirror of
https://github.com/opnsense/src.git
synced 2026-02-04 03:00:53 -06:00
netlink/route: validate family attribute
PR: 283818 (cherry picked from commit cdacb12065e4d85416655743da5bc6b17a9d9119)
This commit is contained in:
parent
5add872c4e
commit
a47d77f946
@ -956,7 +956,7 @@ rtnl_handle_newroute(struct nlmsghdr *hdr, struct nlpcb *nlp,
|
||||
/* pre-2.6.19 Linux API compatibility */
|
||||
if (attrs.rtm_table > 0 && attrs.rta_table == 0)
|
||||
attrs.rta_table = attrs.rtm_table;
|
||||
if (attrs.rta_table >= V_rt_numfibs) {
|
||||
if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family > AF_MAX) {
|
||||
NLMSG_REPORT_ERR_MSG(npt, "invalid fib");
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -1019,7 +1019,7 @@ rtnl_handle_delroute(struct nlmsghdr *hdr, struct nlpcb *nlp,
|
||||
return (ESRCH);
|
||||
}
|
||||
|
||||
if (attrs.rta_table >= V_rt_numfibs) {
|
||||
if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family > AF_MAX) {
|
||||
NLMSG_REPORT_ERR_MSG(npt, "invalid fib");
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -1042,7 +1042,7 @@ rtnl_handle_getroute(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
if (attrs.rta_table >= V_rt_numfibs) {
|
||||
if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family > AF_MAX) {
|
||||
NLMSG_REPORT_ERR_MSG(npt, "invalid fib");
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user