Avoid crash when calling __localeconv_l with __C_locale
__C_locale is const. Thus, overwriting the lconv values in __localeconv_l will try to write to a R/O region. Given the lconv values in __C_locale are initialized, there's no reason to write them in __localeconv_l at all. Just return &__C_locale.lconv. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
		| @@ -6,6 +6,9 @@ struct lconv * | |||||||
| __localeconv_l (struct __locale_t *locale) | __localeconv_l (struct __locale_t *locale) | ||||||
| { | { | ||||||
|   struct lconv *lconv = &locale->lconv; |   struct lconv *lconv = &locale->lconv; | ||||||
|  |   if (locale == __get_C_locale ()) | ||||||
|  |     return lconv; | ||||||
|  |  | ||||||
| #ifdef __HAVE_LOCALE_INFO__ | #ifdef __HAVE_LOCALE_INFO__ | ||||||
|   const struct lc_numeric_T *n = __get_numeric_locale (locale); |   const struct lc_numeric_T *n = __get_numeric_locale (locale); | ||||||
|   const struct lc_monetary_T *m = __get_monetary_locale (locale); |   const struct lc_monetary_T *m = __get_monetary_locale (locale); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user