From: Jeff Davis Date: Mon, 13 Apr 2026 18:19:04 +0000 (-0700) Subject: Fix overrun when comparing with unterminated ICU language string. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06ce97b9994eca91250d7c28f0df9b1ae7829f36;p=thirdparty%2Fpostgresql.git Fix overrun when comparing with unterminated ICU language string. The overrun was introduced in commit c4ff35f10. Author: Andreas Karlsson Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/96d80a47-f17f-42fa-82b1-2908efbd6541@gmail.com Backpatch-through: 18 --- diff --git a/src/backend/utils/adt/pg_locale_icu.c b/src/backend/utils/adt/pg_locale_icu.c index 5ad05fcd016..a4a4e82eb9e 100644 --- a/src/backend/utils/adt/pg_locale_icu.c +++ b/src/backend/utils/adt/pg_locale_icu.c @@ -989,11 +989,11 @@ static int32_t foldcase_options(const char *locale) { uint32 options = U_FOLD_CASE_DEFAULT; - char lang[3]; + char lang[ULOC_LANG_CAPACITY]; UErrorCode status = U_ZERO_ERROR; - uloc_getLanguage(locale, lang, 3, &status); - if (U_SUCCESS(status)) + uloc_getLanguage(locale, lang, ULOC_LANG_CAPACITY, &status); + if (U_SUCCESS(status) && status != U_STRING_NOT_TERMINATED_WARNING) { /* * The option name is confusing, but it causes u_strFoldCase to use