This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] dl-deps.c fix


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]