about summary refs log tree commit diff
path: root/locale/newlocale.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/newlocale.c
parentab41100bab128fa98258aafbb0ab1622884cec4c (diff)
downloadglibc-de18a7061c9bdff73d66502c55d6a3ea671fc6d9.tar.gz
glibc-de18a7061c9bdff73d66502c55d6a3ea671fc6d9.tar.xz
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/newlocale.c')
-rw-r--r--locale/newlocale.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/locale/newlocale.c b/locale/newlocale.c
index 8c5960a45d..561244245b 100644
--- a/locale/newlocale.c
+++ b/locale/newlocale.c
@@ -131,8 +131,7 @@ __newlocale (int category_mask, const char *locale, locale_t base)
 	  for (cnt = 0; cnt < __LC_LAST; ++cnt)
 	    if (cnt != LC_ALL
 		&& (size_t) (cp - np) == _nl_category_name_sizes[cnt]
-		&& memcmp (np, (_nl_category_names.str
-				+ _nl_category_name_idxs[cnt]), cp - np) == 0)
+		&& memcmp (np, (_nl_category_names_get (cnt)), cp - np) == 0)
 	      break;
 
 	  if (cnt == __LC_LAST)