This is the mail archive of the libc-hacker@sources.redhat.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]
Other format: [Raw text]

[PATCH] NULL pointer access in _dl_allocate_tls_init.


Hi,
if the allocation of storage in allocate_dtv fails a NULL
pointer gets passed to _dl_allocate_tls_init and is accessed
before the check.

blue skies,
  Martin.

2003-01-30  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/generic/dl-tls.c (_dl_allocate_tls_init): Avoid NULL
	pointer access.

diff -urN libc/sysdeps/generic/dl-tls.c libc-fixed/sysdeps/generic/dl-tls.c
--- libc/sysdeps/generic/dl-tls.c	Mon Jan 13 10:34:18 2003
+++ libc-fixed/sysdeps/generic/dl-tls.c	Wed Jan 29 16:37:37 2003
@@ -329,7 +329,7 @@
 internal_function
 _dl_allocate_tls_init (void *result)
 {
-  dtv_t *dtv = GET_DTV (result);
+  dtv_t *dtv;
   struct dtv_slotinfo_list *listp;
   size_t total = 0;
 
@@ -337,6 +337,8 @@
     /* The memory allocation failed.  */
     return NULL;
 
+  dtv = GET_DTV (result);
+ 
   /* We have to look prepare the dtv for all currently loaded
      modules using TLS.  For those which are dynamically loaded we
      add the values indicating deferred allocation.  */


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