public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin/main] Cygwin: /proc/locales: use ENCODING_LEN to define array sizes
Date: Sun, 26 Mar 2023 12:18:06 +0000 (GMT)	[thread overview]
Message-ID: <20230326121806.D5EDD3858410@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=68aea16d3f4081cc2af420afe223573526cfcf83

commit 68aea16d3f4081cc2af420afe223573526cfcf83
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Sun Mar 26 12:52:32 2023 +0200
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Sun Mar 26 12:52:32 2023 +0200

    Cygwin: /proc/locales: use ENCODING_LEN to define array sizes
    
    Fixes: c42b98bdc665f ("Cygwin: introduce /proc/codesets and /proc/locales")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler/proc.cc | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
index e0e05f1c1707..961e894736c3 100644
--- a/winsup/cygwin/fhandler/proc.cc
+++ b/winsup/cygwin/fhandler/proc.cc
@@ -2114,15 +2114,15 @@ static BOOL
 format_proc_locale_proc (LPWSTR win_locale, DWORD info, LPARAM param)
 {
   char **bufptr_p = (char **) param;
-  wchar_t iso15924_postfix[32] = { 0 };
-  wchar_t iso15924[32] = { 0 };
-  wchar_t iso3166[32] = { 0 };
-  wchar_t iso639[32] = { 0 };
+  wchar_t iso15924_postfix[ENCODING_LEN + 1] = { 0 };
+  wchar_t iso15924[ENCODING_LEN + 1] = { 0 };
+  wchar_t iso3166[ENCODING_LEN + 1] = { 0 };
+  wchar_t iso639[ENCODING_LEN + 1] = { 0 };
   wchar_t currency[9] = { 0 };
-  char modifier[32] = { 0 };
-  char posix_loc[32];
-  char posix_loc_and_modifier[32];
-  char codeset[32];
+  char modifier[ENCODING_LEN + 1] = { 0 };
+  char posix_loc[ENCODING_LEN + 1];
+  char posix_loc_and_modifier[ENCODING_LEN + 1];
+  char codeset[ENCODING_LEN + 1];
   wchar_t *cp;
 
   /* Skip language-only locales, e. g. "en" */
@@ -2207,15 +2207,15 @@ format_proc_locale_proc (LPWSTR win_locale, DWORD info, LPARAM param)
      add it as modifier if possible, or skip it */
   else if (iso15924[0])
     {
-      wchar_t scriptless_win_locale[32];
-      wchar_t default_iso15924[32];
+      wchar_t scriptless_win_locale[ENCODING_LEN + 1];
+      wchar_t default_iso15924[ENCODING_LEN + 1];
 
       wcpcpy (wcpcpy (wcpcpy (scriptless_win_locale, iso639), L"-"),
 	      iso3166);
       if ((GetLocaleInfoEx (scriptless_win_locale, LOCALE_SSCRIPTS,
-			    default_iso15924, 32)
+			    default_iso15924, ENCODING_LEN + 1)
 	   || GetLocaleInfoEx (iso639, LOCALE_SSCRIPTS,
-			       default_iso15924, 32))
+			       default_iso15924, ENCODING_LEN + 1))
 	  && !wcsstr (default_iso15924, iso15924))
 	{
 	  if (!wcscmp (iso15924, L"Latn;"))

                 reply	other threads:[~2023-03-26 12:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230326121806.D5EDD3858410@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).