+2024-02-15 Bruno Haible <bruno@clisp.org>
+
+ localename: Add parameter validation.
+ * lib/localename.c (get_locale_t_name, gl_locale_name_thread_unsafe,
+ gl_locale_name_thread, gl_locale_name_posix, gl_locale_name): Verify
+ that the category argument is not LC_ALL.
+
2024-02-14 Bruno Haible <bruno@clisp.org>
localename: Notice setlocale() invocations on more platforms.
static const char *
get_locale_t_name (int category, locale_t locale)
{
+ if (category == LC_ALL)
+ /* Invalid argument. */
+ abort ();
if (locale == LC_GLOBAL_LOCALE)
{
/* Query the global locale. */
const char *
gl_locale_name_thread_unsafe (int category, _GL_UNUSED const char *categoryname)
{
+ if (category == LC_ALL)
+ /* Invalid argument. */
+ abort ();
# if HAVE_GOOD_USELOCALE
{
locale_t thread_locale = uselocale (NULL);
const char *
gl_locale_name_thread (int category, _GL_UNUSED const char *categoryname)
{
+ if (category == LC_ALL)
+ /* Invalid argument. */
+ abort ();
#if HAVE_GOOD_USELOCALE
const char *name = gl_locale_name_thread_unsafe (category, categoryname);
if (name != NULL)
const char *
gl_locale_name_posix (int category, _GL_UNUSED const char *categoryname)
{
+ if (category == LC_ALL)
+ /* Invalid argument. */
+ abort ();
#if defined WINDOWS_NATIVE
if (LC_MIN <= category && category <= LC_MAX)
{
{
const char *retval;
+ if (category == LC_ALL)
+ /* Invalid argument. */
+ abort ();
+
retval = gl_locale_name_thread (category, categoryname);
if (retval != NULL)
return retval;