aboutsummaryrefslogtreecommitdiff
path: root/locale/findlocale.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-09-05 22:16:58 +0200
committerFlorian Weimer <fweimer@redhat.com>2019-09-05 22:16:58 +0200
commitde18a7061c9bdff73d66502c55d6a3ea671fc6d9 (patch)
treed3d4d3a27d9ac4aea5fc088a884cc2ec5f256ce7 /locale/findlocale.c
parentab41100bab128fa98258aafbb0ab1622884cec4c (diff)
downloadglibc-de18a7061c9bdff73d66502c55d6a3ea671fc6d9.tar
glibc-de18a7061c9bdff73d66502c55d6a3ea671fc6d9.tar.gz
glibc-de18a7061c9bdff73d66502c55d6a3ea671fc6d9.tar.bz2
glibc-de18a7061c9bdff73d66502c55d6a3ea671fc6d9.zip
locale: Avoid zero-length array in _nl_category_names [BZ #24962]
The union wrapper is unnecessary because C allows to read any object as a sequence of chars. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'locale/findlocale.c')
-rw-r--r--locale/findlocale.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/locale/findlocale.c b/locale/findlocale.c
index 9af605bd64..28b0226265 100644
--- a/locale/findlocale.c
+++ b/locale/findlocale.c
@@ -118,8 +118,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
variables. */
cloc_name = getenv ("LC_ALL");
if (!name_present (cloc_name))
- cloc_name = getenv (_nl_category_names.str
- + _nl_category_name_idxs[category]);
+ cloc_name = getenv (_nl_category_names_get (category));
if (!name_present (cloc_name))
cloc_name = getenv ("LANG");
if (!name_present (cloc_name))
@@ -207,8 +206,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
locale_path, locale_path_len, mask,
language, territory, codeset,
normalized_codeset, modifier,
- _nl_category_names.str
- + _nl_category_name_idxs[category], 0);
+ _nl_category_names_get (category), 0);
if (locale_file == NULL)
{
@@ -218,8 +216,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
locale_path, locale_path_len, mask,
language, territory, codeset,
normalized_codeset, modifier,
- _nl_category_names.str
- + _nl_category_name_idxs[category], 1);
+ _nl_category_names_get (category), 1);
if (locale_file == NULL)
/* This means we are out of core. */
return NULL;