pgsql: Fix string truncation to be multibyte-aware in text_name and bpc

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix string truncation to be multibyte-aware in text_name and bpc
Date: 2012-05-25 21:35:55
Message-ID: E1SY2At-0001MZ-3I@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix string truncation to be multibyte-aware in text_name and bpchar_name.

Previously, casts to name could generate invalidly-encoded results.

Also, make these functions match namein() more exactly, by consistently
using palloc0() instead of ad-hoc zeroing code.

Back-patch to all supported branches.

Karl Schnaitter and Tom Lane

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/71e985a07a7ae9319c00629f319a4c30a9e32fd6

Modified Files
--------------
src/backend/utils/adt/name.c | 10 +++++++---
src/backend/utils/adt/varchar.c | 14 ++++----------
src/backend/utils/adt/varlena.c | 12 +++---------
3 files changed, 14 insertions(+), 22 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2012-05-26 23:10:52 pgsql: Prevent synchronized scanning when systable_beginscan chooses a
Previous Message Tom Lane 2012-05-25 18:36:37 pgsql: Use binary search instead of brute-force scan in findNamespace()