[PATCH] dl-deps.c fix
Jakub Jelinek
jakub@redhat.com
Mon May 8 12:24:00 GMT 2000
Hi!
L->l_initfini is sometimes created zero terminated, sometimes not.
This can cause accessing l_initfini beyond the end of the allocated string
(seen in _dl_fini) and things then depend on the stage of the noon and
program may crash (seen as well).
2000-05-08 Jakub Jelinek <jakub@redhat.com>
* elf/dl-deps.c (_dl_map_object_deps): Zero terminate L->l_initfini
always.
--- libc/elf/dl-deps.c.jj Tue Apr 18 08:13:12 2000
+++ libc/elf/dl-deps.c Mon May 8 21:01:53 2000
@@ -465,7 +465,7 @@ _dl_map_object_deps (struct link_map *ma
/* Store the search list we built in the object. It will be used for
searches in the scope of this object. */
- map->l_searchlist.r_list = malloc ((2 * nlist
+ map->l_searchlist.r_list = malloc ((2 * nlist + 1
+ (nlist == nduplist ? 0 : nduplist))
* sizeof (struct link_map *));
if (map->l_searchlist.r_list == NULL)
@@ -549,4 +549,6 @@ _dl_map_object_deps (struct link_map *ma
}
}
}
+ /* Terminate the list of dependencies */
+ map->l_initfini[nlist] = NULL;
}
Jakub
More information about the Libc-hacker
mailing list