From 18b7958e47b77b3a795ff4022c454c425bbae26d Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Wed, 18 Jan 2023 15:53:10 -0300 Subject: [PATCH] zebra: fix fpm netlink encode out of bounds read Don't attempt to encode the pointer address instead pass the pointer directly so the real contents can be accessed. (`ri->pref_src` type is `union g_addr *`) Found by Coverity Scan (CID 1482162) Signed-off-by: Rafael Zalamena --- zebra/zebra_fpm_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index 5cefa16cdd..628d4a2a87 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -511,7 +511,7 @@ static int netlink_route_info_encode(struct netlink_route_info *ri, done: if (ri->pref_src) { - nl_attr_put(&req->n, in_buf_len, RTA_PREFSRC, &ri->pref_src, + nl_attr_put(&req->n, in_buf_len, RTA_PREFSRC, ri->pref_src, bytelen); }