ltree/crc32.c: fix fragile code.

Explicitly make space for the NUL when casefolding.

No known bug in the previous code, because the previous buffer (size
12) was more than large enough for folding any codepoint with enough
room left for a NUL. The builtin provider's limit is 7; ICU's limit
seems to be 7 also; and libc always does 1:1 mappings so the real
limit is MAX_MULTIBYTE_CHAR_LEN + 1 (size 5).

Reviewed-by: Heikki Linnakangas <[email protected]>
Reviewed-by: Rithvika Devisetti <[email protected]>
Discussion: 
https://postgr.es/m/[email protected]
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/aea7bed4a755cab63fb667314a735b0ea3e6e688

Modified Files
--------------
contrib/ltree/crc32.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

Reply via email to