diff options
author | Patsy Franklin <pfrankli@redhat.com> | 2017-08-29 15:53:28 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2017-08-29 15:53:28 +0200 |
commit | 1cf1232cd4721dc155a5cf7d571e5b1dae506430 (patch) | |
tree | bb78b85294b07816b899e8ecac58b9bc5a41475a /wcsmbs | |
parent | f11f2f6e145d6fc6b52f6b0733599f8b96595733 (diff) | |
download | glibc-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 'wcsmbs')
-rw-r--r-- | wcsmbs/btowc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/wcsmbs/btowc.c b/wcsmbs/btowc.c index 22464dc5e2..97fb7170f3 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 |