From b824a896ac4fd212a27ce1862cc77e09c13f5b84 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 23 Aug 2021 18:15:20 +0100 Subject: [PATCH] jail: preload: avoid NULL-dereference in case things go wrong Coverity CID: 1446096 Dereference after null check Coverity CID: 1446070 Dereference after null check Signed-off-by: Daniel Golle --- jail/preload.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jail/preload.c b/jail/preload.c index 9678ab6..351a9f8 100644 --- a/jail/preload.c +++ b/jail/preload.c @@ -62,8 +62,10 @@ int __libc_start_main(main_t main, start_main_t __start_main__; __start_main__ = dlsym(RTLD_NEXT, "__libc_start_main"); - if (!__start_main__) + if (!__start_main__) { INFO("failed to find __libc_start_main %s\n", dlerror()); + return -1; + } __main__ = main; @@ -82,8 +84,10 @@ void __uClibc_main(main_t main, uClibc_main __start_main__; __start_main__ = dlsym(RTLD_NEXT, "__uClibc_main"); - if (!__start_main__) + if (!__start_main__) { INFO("failed to find __uClibc_main %s\n", dlerror()); + return; + } __main__ = main; -- 2.30.2