postgres.git / summary / log / commit / refs

commit    dacd8fa6f259e25f747d6d71290d9d5ed86095df
Author:   Jeff Davis <jdavis@postgresql.org>
Date:     Tue Apr 14 19:06:02 2026 +0000
First released in: 19.0, 16.14, 17.10, 18.4

    Check for unterminated strings when calling uloc_getLanguage().
    
    Missed by commit 1671f990dd66.
    
    Author: Andreas Karlsson <andreas@proxel.se>
    Discussion: https://postgr.es/m/118ca69e-47eb-42e1-83e9-72ccf40dd6fd@proxel.se
    Backpatch-through: 16


src/bin/initdb/initdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 509f1114ef6..2ee834f0765 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -2403,7 +2403,7 @@ icu_validate_locale(const char *loc_str) /* validate that we can extract the language */ status = U_ZERO_ERROR; uloc_getLanguage(loc_str, lang, ULOC_LANG_CAPACITY, &status); - if (U_FAILURE(status)) + if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) { pg_fatal("could not get language from locale \"%s\": %s", loc_str, u_errorName(status)); @@ -2423,7 +2423,7 @@ icu_validate_locale(const char *loc_str) status = U_ZERO_ERROR; uloc_getLanguage(otherloc, otherlang, ULOC_LANG_CAPACITY, &status); - if (U_FAILURE(status)) + if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) continue; if (strcmp(lang, otherlang) == 0) [parent: 67d318e70402]