aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2016-07-15 19:07:00 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2016-07-15 19:07:00 +0000
commit1c1093d6d63da102fde664995fe5d9874828d15d (patch)
tree044099e1848ed54e4458a325fccf3311ddf8eeba /libexec
parentdb2627f4b17503f18f0048eb04b1d25f42107730 (diff)
Fix dlsym(RTLD_NEXT) handling to only return the next library in last library cases.
The root of the problem here is that TAILQ_FOREACH_FROM will default to the head of the list if passed NULL, which will be the case if there are no libraries loaded after this one. Thus all libraries, including the current, were iterated in that case rather than none. This was broken in r294373. Reviewed by: markj (earlier version), cem, kib, ngie MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D7216
Notes
Notes: svn path=/head/; revision=302908
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 1869194150ed..ca722cfa175b 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -3291,7 +3291,7 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve,
handle == RTLD_SELF) { /* ... caller included */
if (handle == RTLD_NEXT)
obj = globallist_next(obj);
- TAILQ_FOREACH_FROM(obj, &obj_list, next) {
+ for (; obj != NULL; obj = TAILQ_NEXT(obj, next)) {
if (obj->marker)
continue;
res = symlook_obj(&req, obj);