about summary refs log tree commit diff
path: root/iconv/gconv_cache.c
diff options
context:
space:
mode:
authorPatsy Franklin <pfrankli@redhat.com>2017-08-29 15:53:28 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-08-29 15:53:28 +0200
commit1cf1232cd4721dc155a5cf7d571e5b1dae506430 (patch)
treebb78b85294b07816b899e8ecac58b9bc5a41475a /iconv/gconv_cache.c
parentf11f2f6e145d6fc6b52f6b0733599f8b96595733 (diff)
downloadglibc-1cf1232cd4721dc155a5cf7d571e5b1dae506430.tar.gz
glibc-1cf1232cd4721dc155a5cf7d571e5b1dae506430.tar.xz
glibc-1cf1232cd4721dc155a5cf7d571e5b1dae506430.zip
gconv: Consistently mangle NULL function pointers [BZ #22025]
Not mangling NULL pointers is not safe because with very low
probability, a non-NULL function pointer can turn into a NULL pointer
after mangling.
Diffstat (limited to 'iconv/gconv_cache.c')
-rw-r--r--iconv/gconv_cache.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c
index d6a47de838..7d2751a506 100644
--- a/iconv/gconv_cache.c
+++ b/iconv/gconv_cache.c
@@ -207,17 +207,16 @@ find_module (const char *directory, const char *filename,
       result->__data = NULL;
 
       /* Call the init function.  */
-      if (result->__init_fct != NULL)
-	{
-	  __gconv_init_fct init_fct = result->__init_fct;
+      __gconv_init_fct init_fct = result->__init_fct;
 #ifdef PTR_DEMANGLE
-	  PTR_DEMANGLE (init_fct);
+      PTR_DEMANGLE (init_fct);
 #endif
+      if (init_fct != NULL)
+	{
 	  status = DL_CALL_FCT (init_fct, (result));
 
 #ifdef PTR_MANGLE
-	  if (result->__btowc_fct != NULL)
-	    PTR_MANGLE (result->__btowc_fct);
+	  PTR_MANGLE (result->__btowc_fct);
 #endif
 	}
     }