[PATCH] NULL pointer access in _dl_allocate_tls_init.

Martin Schwidefsky schwidefsky@de.ibm.com
Thu Jan 30 08:29:00 GMT 2003


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.  */



More information about the Libc-hacker mailing list