Browse Source

m68k: fix SUPPORT_LD_DEBUG null pointer access

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 <jeanmichel.hautbois@yoseli.org>
Link: https://mailman.openadk.org/mailman3/hyperkitty/list/devel@uclibc-ng.org/thread/ODLJ53XJU5ZG3OLHVJMVWSNBYIFHFBAT/
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Peter Seiderer 2 months ago
parent
commit
73365a3656
1 changed files with 2 additions and 2 deletions
  1. 2 2
      ldso/ldso/m68k/elfinterp.c

+ 2 - 2
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) {