ICU: check for U_STRING_NOT_TERMINATED_WARNING.

Jeff Davis <jdavis@postgresql.org>

Commit: 1c634f6647c28354258d114041252475325aea32
Author: Jeff Davis <jdavis@postgresql.org>
Date: 2023-05-17T21:18:45Z
Releases: 16.0
ICU: check for U_STRING_NOT_TERMINATED_WARNING.

Fixes memory error in cases where the length of the language name
returned by uloc_getLanguage() is exactly ULOC_LANG_CAPACITY, in which
case the status is set to U_STRING_NOT_TERMINATED_WARNING.

Also check in call sites for other ICU functions that are expected to
return a C string to be safe (no bug is known at these other call
sites).

Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/2098874d-c111-41e4-9063-30bcf135226b@gmail.com

Files

PathChange+/−
src/backend/utils/adt/pg_locale.c modified +11 −18
src/bin/initdb/initdb.c modified +4 −11

Discussion