From 8ca7a3ed38ae84d0f8d4870f789362522544542e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sun, 14 Feb 2021 16:04:16 -0500 Subject: [PATCH] nhrpd: Fix clang SA about null deref Clang was complaining when running SA that the nhrpd_privs.change function was null. It just does not fully understand how things are setup. Add a assert to make it happy. Signed-off-by: Donald Sharp --- nhrpd/nhrp_main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nhrpd/nhrp_main.c b/nhrpd/nhrp_main.c index 9fc13761c8..49a4900bf8 100644 --- a/nhrpd/nhrp_main.c +++ b/nhrpd/nhrp_main.c @@ -144,8 +144,13 @@ int main(int argc, char **argv) nhrp_interface_init(); resolver_init(master); - /* Run with elevated capabilities, as for all netlink activity - * we need privileges anyway. */ + /* + * Run with elevated capabilities, as for all netlink activity + * we need privileges anyway. + * The assert is for clang SA code where it does + * not see the change function being set in lib + */ + assert(nhrpd_privs.change); nhrpd_privs.change(ZPRIVS_RAISE); netlink_init();