diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-09-11 11:13:21 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-09-11 11:13:21 +0000 |
commit | 4547a29bb5bafa8c3d8068937641164a9e24f967 (patch) | |
tree | 827bac6ee7c2373c9053daa1bc9eea5f114b6e1d /libexec | |
parent | 96fce850490edbbc74dce5a3ac534944c164c42e (diff) |
Fix lazy binding issue by making sure the second argument to _dl_find_symbol()
always points to a pointer that is initialized to NULL. Consistently use
NULL instead of mixing NULL and 0 to make the pattern more obvious.
Fixes nm(1) crashes that happen when you pass it multiple object files on
the command line.
ok miod@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ld.so/mips64/rtld_machine.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libexec/ld.so/mips64/rtld_machine.c b/libexec/ld.so/mips64/rtld_machine.c index 811f20037e4..5acd2e8b4cb 100644 --- a/libexec/ld.so/mips64/rtld_machine.c +++ b/libexec/ld.so/mips64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.13 2010/05/03 04:19:42 miod Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.14 2010/09/11 11:13:20 kettenis Exp $ */ /* * Copyright (c) 1998-2004 Opsycon AB, Sweden. @@ -232,7 +232,7 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) if (symp->st_shndx == SHN_UNDEF && ELF64_ST_TYPE(symp->st_info) == STT_FUNC) { if (symp->st_value == 0 || !lazy) { - this = 0; + this = NULL; ooff = _dl_find_symbol(strt + symp->st_name, &this, SYM_SEARCH_ALL|SYM_NOWARNNOTFOUND|SYM_PLT, @@ -243,7 +243,7 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) *gotp = symp->st_value + loff; } else if (symp->st_shndx == SHN_COMMON || symp->st_shndx == SHN_UNDEF) { - this = 0; + this = NULL; ooff = _dl_find_symbol(strt + symp->st_name, &this, SYM_SEARCH_ALL|SYM_NOWARNNOTFOUND|SYM_PLT, symp, object, NULL); @@ -253,7 +253,7 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) symp->st_value != *gotp) { *gotp += loff; } else { /* Resolve all others immediately */ - this = 0; + this = NULL; ooff = _dl_find_symbol(strt + symp->st_name, &this, SYM_SEARCH_ALL|SYM_NOWARNNOTFOUND|SYM_PLT, symp, object, NULL); @@ -291,6 +291,7 @@ _dl_bind(elf_object_t *object, int symidx) n = object->Dyn.info[DT_MIPS_LOCAL_GOTNO - DT_LOPROC + DT_NUM] - object->Dyn.info[DT_MIPS_GOTSYM - DT_LOPROC + DT_NUM]; + this = NULL; ooff = _dl_find_symbol(symn, &this, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_PLT, sym, object, NULL); if (this == NULL) { |