aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2025-01-29 22:06:57 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2025-01-29 23:48:55 +0000
commit031fbf8dc962ca8d458b217ba2b4a9e637b7e932 (patch)
tree8614c91c61542f052cc9c7a89f0b39a842bfce94
parent49a6e213416b5c0c9eccdff0af1c6b01f34c3693 (diff)
netlink/route: fix fib number validation in old Linux compat mode
The value passed via old field also needs to be validated. PR: 283848 Fixes: f34aca55adef1e28cd68b2e6705a0cac03f0238e
-rw-r--r--sys/netlink/route/rt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c
index 1ee18f994c65..9750ad9d0649 100644
--- a/sys/netlink/route/rt.c
+++ b/sys/netlink/route/rt.c
@@ -952,10 +952,10 @@ rtnl_handle_newroute(struct nlmsghdr *hdr, struct nlpcb *nlp,
return (EINVAL);
}
- if (attrs.rtm_table > 0 && attrs.rta_table == 0) {
- /* pre-2.6.19 Linux API compatibility */
+ /* pre-2.6.19 Linux API compatibility */
+ if (attrs.rtm_table > 0 && attrs.rta_table == 0)
attrs.rta_table = attrs.rtm_table;
- } else if (attrs.rta_table >= V_rt_numfibs) {
+ if (attrs.rta_table >= V_rt_numfibs) {
NLMSG_REPORT_ERR_MSG(npt, "invalid fib");
return (EINVAL);
}