From: Jeff Davis Date: Tue, 14 Apr 2026 19:06:02 +0000 (-0700) Subject: Check for unterminated strings when calling uloc_getLanguage(). X-Git-Tag: REL_16_14~57 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=8167371704bd2ae26304878c1d6d167dabed0c71;p=thirdparty%2Fpostgresql.git Check for unterminated strings when calling uloc_getLanguage(). Missed by commit 1671f990dd66. Author: Andreas Karlsson Discussion: https://postgr.es/m/118ca69e-47eb-42e1-83e9-72ccf40dd6fd@proxel.se Backpatch-through: 16 --- diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 3dbade0ea37..f2ee1d999b4 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -2353,7 +2353,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)); @@ -2373,7 +2373,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)