This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] locale: Avoid zero-length array in _nl_category_names [BZ #24962]
- From: Jeff Law <law at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>, libc-alpha at sourceware dot org
- Cc: Martin Sebor <msebor at redhat dot com>
- Date: Thu, 5 Sep 2019 07:25:53 -0600
- Subject: Re: [PATCH] locale: Avoid zero-length array in _nl_category_names [BZ #24962]
- References: <87a7bjkxhv.fsf@oldenburg2.str.redhat.com>
On 9/5/19 1:34 AM, Florian Weimer wrote:
> (Martin, can you give this a test using GCC 10? I don't expect any
> issues because the zero-length array is completely gone. The patch
> passed testing on x86_64-linux-gnu without regressions, but with GCC 9.)
>
> The union wrapper is unnecessary because C allows to read any object
> as a sequence of chars.
>
> 2019-09-05 Florian Weimer <fweimer@redhat.com>
>
> [BZ #24962]
> * locale/localeinfo.h (_nl_category_names): Remove union wrapper.
> (_nl_category_names_get): New function.
> * intl/dcigettext.c (category_to_name): Call it.
> * locale/findlocale.c (_nl_find_locale): Likewise.
> * intl/loadlocale.c (_nl_load_locale): Likewise.
> * locale/newlocale.c (__newlocale): Likewise.
> * locale/setlocale.c (_nl_category_names): Adjust definition.
> (_nl_category_name_idxs): Likewise.
> (new_composite_name): Call _nl_category_names_get.
> (setlocale): Likewise.
Might be easier for me than Martin. I just threw it into my github
repo, so my tester will pick it up as of now. Will report back in a few
hours.
jeff