aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Chisnall <theraven@FreeBSD.org>2021-02-02 14:06:33 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-02-09 15:05:44 +0000
commit07eed38ae2de9b0194c1beef797c05cf57cdcd97 (patch)
tree2891445cf33b7ab3c707f11ed69fec7a1a82db0f
parent45c95531c0a2b48a79137555a9cda12137045391 (diff)
downloadsrc-07eed38ae2de9b0194c1beef797c05cf57cdcd97.tar.gz
src-07eed38ae2de9b0194c1beef797c05cf57cdcd97.zip
rtld: Fix null-pointer dereference
Approved by: re (gjb) (cherry picked from commit 43d44842aef3972cc86ce673e84e31f372257b15)
-rw-r--r--libexec/rtld-elf/rtld.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 7b8bfba84d7d..b186bebbfefc 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -894,8 +894,10 @@ _rtld_bind(Obj_Entry *obj, Elf_Size reloff)
target = (Elf_Addr)(defobj->relocbase + def->st_value);
dbg("\"%s\" in \"%s\" ==> %p in \"%s\"",
- defobj->strtab + def->st_name, basename(obj->path),
- (void *)target, basename(defobj->path));
+ defobj->strtab + def->st_name,
+ obj->path == NULL ? NULL : basename(obj->path),
+ (void *)target,
+ defobj->path == NULL ? NULL : basename(defobj->path));
/*
* Write the new contents for the jmpslot. Note that depending on