pgsql: Fix incorrect buffer-length argument to uloc_getDisplayName().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix incorrect buffer-length argument to uloc_getDisplayName().
Date: 2017-06-23 20:01:05
Message-ID: E1dOUlN-00010D-Co@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix incorrect buffer-length argument to uloc_getDisplayName().

The maxResultSize argument of uloc_getDisplayName is the number of
UChars in the output buffer, not the number of bytes. In principle
this could result in a stack smash, although at least in my Fedora 25
install there are no ICU locales with display names long enough to
overrun the buffer. But it's easily proven to be wrong by reducing
the length of displayname to around 20, whereupon a stack smash
does happen.

(This is a rather scary bug, because the same mistake could easily
have been made in other places; but in a quick code search looking
at uses of UChar I could not find any other instances.)

Branch
------
master

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

Modified Files
--------------
src/backend/commands/collationcmds.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2017-06-24 12:04:57 pgsql: Revert 1f30295eab65eddaa88528876ab66e7095f4bb65
Previous Message Peter Eisentraut 2017-06-23 19:43:09 pgsql: Fix replication with replica identity full