From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id D5EDD3858410; Sun, 26 Mar 2023 12:18:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5EDD3858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679833086; bh=ndi+x/wUDyAsJ1Lluuxeo+YondIlEgKtHe6q+QPPYSU=; h=From:To:Subject:Date:From; b=b9kmy/NS5IiZOtR42GvdntrbMGW1mm4+z5zcrshYI2GnfcsvqpQxCyGP312Rsci0d 7rcUgTVDfokdtwU+h4ZyZo17Cs0Rm25ITF2dORUhCBCR1sI7Gsr9+XlGADoOu26c5Q oWEwrfYlxCePXVta/Vsn9k0i177YE8Iid5OYomz0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: /proc/locales: use ENCODING_LEN to define array sizes X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: 4e578fad7927b074837475ccbff698a20742f78d X-Git-Newrev: 68aea16d3f4081cc2af420afe223573526cfcf83 Message-Id: <20230326121806.D5EDD3858410@sourceware.org> Date: Sun, 26 Mar 2023 12:18:06 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D68aea16d3f4= 081cc2af420afe223573526cfcf83 commit 68aea16d3f4081cc2af420afe223573526cfcf83 Author: Corinna Vinschen AuthorDate: Sun Mar 26 12:52:32 2023 +0200 Commit: Corinna Vinschen CommitDate: Sun Mar 26 12:52:32 2023 +0200 Cygwin: /proc/locales: use ENCODING_LEN to define array sizes =20 Fixes: c42b98bdc665f ("Cygwin: introduce /proc/codesets and /proc/local= es") Signed-off-by: Corinna Vinschen 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 =3D (char **) param; - wchar_t iso15924_postfix[32] =3D { 0 }; - wchar_t iso15924[32] =3D { 0 }; - wchar_t iso3166[32] =3D { 0 }; - wchar_t iso639[32] =3D { 0 }; + wchar_t iso15924_postfix[ENCODING_LEN + 1] =3D { 0 }; + wchar_t iso15924[ENCODING_LEN + 1] =3D { 0 }; + wchar_t iso3166[ENCODING_LEN + 1] =3D { 0 }; + wchar_t iso639[ENCODING_LEN + 1] =3D { 0 }; wchar_t currency[9] =3D { 0 }; - char modifier[32] =3D { 0 }; - char posix_loc[32]; - char posix_loc_and_modifier[32]; - char codeset[32]; + char modifier[ENCODING_LEN + 1] =3D { 0 }; + char posix_loc[ENCODING_LEN + 1]; + char posix_loc_and_modifier[ENCODING_LEN + 1]; + char codeset[ENCODING_LEN + 1]; wchar_t *cp; =20 /* Skip language-only locales, e. g. "en" */ @@ -2207,15 +2207,15 @@ format_proc_locale_proc (LPWSTR win_locale, DWORD i= nfo, 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]; =20 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;"))