postgres.git / summary / log / commit / refs
commit 6393259bd49db307c7113d70da355544479ee342
Author: Jeff Davis <jdavis@postgresql.org>
Date: Mon Apr 13 18:19:21 2026 +0000
First released in: 19.0, 18.4
Fix overrun when comparing with unterminated ICU language string.
The overrun was introduced in commit c4ff35f10.
Author: Andreas Karlsson <andreas@proxel.se>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/96d80a47-f17f-42fa-82b1-2908efbd6541@gmail.com
Backpatch-through: 18
src/backend/utils/adt/pg_locale_icu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/backend/utils/adt/pg_locale_icu.c b/src/backend/utils/adt/pg_locale_icu.c
index ff4541a64f3..4f401a28f0d 100644
--- a/src/backend/utils/adt/pg_locale_icu.c
+++ b/src/backend/utils/adt/pg_locale_icu.c
@@ -702,7 +702,7 @@ u_strFoldCase_default(UChar *dest, int32_t destCapacity,
UErrorCode *pErrorCode)
{
uint32 options = U_FOLD_CASE_DEFAULT;
- char lang[3];
+ char lang[ULOC_LANG_CAPACITY];
UErrorCode status;
/*
@@ -712,8 +712,8 @@ u_strFoldCase_default(UChar *dest, int32_t destCapacity,
* languages to enable the option.
*/
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
[parent: 540fe8fb5c22]