newlib-cygwin/newlib/libc/locale
Corinna Vinschen 85be74f295 newlocale: fix crash when trying to write to __C_locale
This simple testcase:

  locale_t st = newlocale(LC_ALL_MASK, "C", (locale_t)0);
  locale_t st2 = newlocale(LC_CTYPE_MASK, "en_US.UTF-8", st);

is sufficient to reproduce a crash in _newlocale_r.  After the first call
to newlocale, `st' points to __C_locale, which is const.  When using `st'
as locale base in the second call, _newlocale_r tries to set pointers
inside base to NULL.  This is bad if base is __C_locale, obviously.

Add a test to avoid trying to overwrite pointer values inside base if
base is __C_locale.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-12 12:29:26 +02:00
..
Makefile.inc newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
duplocale.c locale: remove TRAD_SYNOPSIS 2017-12-01 03:41:50 -06:00
freelocale.c locale: remove TRAD_SYNOPSIS 2017-12-01 03:41:50 -06:00
lctype.c Remove non-working __part_load_locale function and any related code 2016-08-15 10:56:57 +02:00
lmessages.c Remove non-working __part_load_locale function and any related code 2016-08-15 10:56:57 +02:00
lmonetary.c Remove non-working __part_load_locale function and any related code 2016-08-15 10:56:57 +02:00
lnumeric.c Remove non-working __part_load_locale function and any related code 2016-08-15 10:56:57 +02:00
locale.c Add --enable-newlib-reent-thread-local option 2022-07-13 06:55:46 +02:00
locale.tex Fix mismatched parentheses in documentation. 2015-06-24 12:23:25 +01:00
localeconv.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
newlocale.c newlocale: fix crash when trying to write to __C_locale 2022-08-12 12:29:26 +02:00
nl_langinfo.3 * libc/include/langinfo.h: New file. 2002-08-23 01:56:05 +00:00
nl_langinfo.c nl_langinfo: Add NL_LOCALE_NAME macro 2017-01-20 10:30:47 +01:00
setlocale.h Add _REENT_LOCALE(ptr) 2022-07-13 06:55:46 +02:00
timelocal.c Remove non-working __part_load_locale function and any related code 2016-08-15 10:56:57 +02:00
uselocale.c Add _REENT_LOCALE(ptr) 2022-07-13 06:55:46 +02:00