Fix null pointer access in case SUPPORT_LD_DEBUG configuration option is
enabled (hit in _dl_do_reloc, but fix same old_val/reloc_addr usage pattern
in _dl_do_lazy_reloc too).

Reported-by: Jean-Michel Hautbois <[email protected]>
Link: 
https://mailman.openadk.org/mailman3/hyperkitty/list/[email protected]/thread/ODLJ53XJU5ZG3OLHVJMVWSNBYIFHFBAT/
Signed-off-by: Peter Seiderer <[email protected]>
---
Changes v1 -> v2:
  - fix same old_val/reloc_addr usage pattern in _dl_do_lazy_reloc too
  - reword commit message
---
 ldso/ldso/m68k/elfinterp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ldso/ldso/m68k/elfinterp.c b/ldso/ldso/m68k/elfinterp.c
index 25ea23067..e7fa117da 100644
--- a/ldso/ldso/m68k/elfinterp.c
+++ b/ldso/ldso/m68k/elfinterp.c
@@ -193,7 +193,7 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct r_scope_elem 
*scope,
 #endif
 
 #if defined (__SUPPORT_LD_DEBUG__)
-       old_val = *reloc_addr;
+       old_val = reloc_addr ? *reloc_addr : 0;
 #endif
 
        switch (reloc_type) {
@@ -292,7 +292,7 @@ _dl_do_lazy_reloc(struct elf_resolve *tpnt, struct 
r_scope_elem *scope,
        reloc_type = ELF_R_TYPE(rpnt->r_info);
 
 #if defined (__SUPPORT_LD_DEBUG__)
-       old_val = *reloc_addr;
+       old_val = reloc_addr ? *reloc_addr : 0;
 #endif
 
        switch (reloc_type) {
-- 
2.48.1

_______________________________________________
devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to