aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPouria Mousavizadeh Tehrani <pouria@FreeBSD.org>2026-07-31 16:39:23 +0000
committerPouria Mousavizadeh Tehrani <pouria@FreeBSD.org>2026-07-31 16:39:23 +0000
commit82e4762f42a063785e5d19abcacd7e4a4eb3e548 (patch)
treebf239626277218d74c956c203d5bf8e11d6bd45a
parent833bdae6c58bcede4d9d5e64612b34295558de0b (diff)
route(8): Add null check for prefsrc option
Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>, bms Fixes: dd235f097af4 ("route(8): Add prefsrc option in netlink")
-rw-r--r--sbin/route/route_netlink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/route/route_netlink.c b/sbin/route/route_netlink.c
index a412265b6feb..f145771ebb12 100644
--- a/sbin/route/route_netlink.c
+++ b/sbin/route/route_netlink.c
@@ -226,7 +226,8 @@ rtmsg_nl_int(struct nl_helper *h, int cmd, int rtm_flags, int fib, int rtm_addrs
rtm->rtm_flags = RTM_F_PREFIX;
snl_add_msg_attr_ip(&nw, RTA_DST, dst);
- snl_add_msg_attr_ip(&nw, RTA_PREFSRC, prefsrc);
+ if (prefsrc != NULL)
+ snl_add_msg_attr_ip(&nw, RTA_PREFSRC, prefsrc);
snl_add_msg_attr_u32(&nw, RTA_TABLE, fib);
uint32_t rta_oif = 0;