public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: /proc/locales: use ENCODING_LEN to define array sizes
@ 2023-03-26 12:18 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-03-26 12:18 UTC (permalink / raw)
  To: cygwin-cvs

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;"))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-26 12:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-26 12:18 [newlib-cygwin/main] Cygwin: /proc/locales: use ENCODING_LEN to define array sizes Corinna Vinschen

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).