From 1cf1232cd4721dc155a5cf7d571e5b1dae506430 Mon Sep 17 00:00:00 2001 From: Patsy Franklin Date: Tue, 29 Aug 2017 15:53:28 +0200 Subject: 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. --- wcsmbs/btowc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'wcsmbs') diff --git a/wcsmbs/btowc.c b/wcsmbs/btowc.c index 22464dc..97fb717 100644 --- a/wcsmbs/btowc.c +++ b/wcsmbs/btowc.c @@ -46,15 +46,15 @@ __btowc (int c) /* Get the conversion functions. */ fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE)); __gconv_btowc_fct btowc_fct = fcts->towc->__btowc_fct; +#ifdef PTR_DEMANGLE + if (fcts->towc->__shlib_handle != NULL) + PTR_DEMANGLE (btowc_fct); +#endif if (__builtin_expect (fcts->towc_nsteps == 1, 1) && __builtin_expect (btowc_fct != NULL, 1)) { /* Use the shortcut function. */ -#ifdef PTR_DEMANGLE - if (fcts->towc->__shlib_handle != NULL) - PTR_DEMANGLE (btowc_fct); -#endif return DL_CALL_FCT (btowc_fct, (fcts->towc, (unsigned char) c)); } else -- cgit v1.1