summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-08-31 00:44:29 +0100
committerDaniel Golle <daniel@makrotopia.org>2021-08-31 00:46:59 +0100
commit269c9e4c7e5b6a726712abf939255980f03266c5 (patch)
tree34664971de1833c56dcc649a0d7e1646ebab24b8
parentf5fe04b93a2131bd57f34f4d526e57933caa8a4c (diff)
downloadprocd-269c9e4c7e5b6a726712abf939255980f03266c5.tar.gz
trace: preload: avoid NULL-dereference here as well
Fix potential NULL-pointer derefence in trace/preload.c similar to how it was fixed in jail/preload.c by commit b824a89 ("jail: preload: avoid NULL-dereference in case things go wrong"). Coverity CID: 1446096 Dereference after null check Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--trace/preload.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/trace/preload.c b/trace/preload.c
index ee97429..457bd82 100644
--- a/trace/preload.c
+++ b/trace/preload.c
@@ -49,9 +49,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__) {
ERROR("failed to find __libc_start_main %s\n", dlerror());
-
+ return -1;
+ }
__main__ = main;
return (*__start_main__)(__preload_main__, argc, argv, auxvec,
@@ -69,8 +70,10 @@ void __uClibc_main(main_t main,
uClibc_main __start_main__;
__start_main__ = dlsym(RTLD_NEXT, "__uClibc_main");
- if (!__start_main__)
+ if (!__start_main__) {
ERROR("failed to find __uClibc_main %s\n", dlerror());
+ return;
+ }
__main__ = main;