git: 82e4762f42a0 - main - route(8): Add null check for prefsrc option
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 31 Jul 2026 16:54:56 UTC
The branch main has been updated by pouria:
URL: https://cgit.FreeBSD.org/src/commit/?id=82e4762f42a063785e5d19abcacd7e4a4eb3e548
commit 82e4762f42a063785e5d19abcacd7e4a4eb3e548
Author: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-07-31 16:39:23 +0000
Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-07-31 16:39:23 +0000
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")
---
sbin/route/route_netlink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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;