pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix incorrect buffer-length argument to uloc_getDisplayName().
Date: Fri, 23 Jun 2017 20:01:05 +0000
Message-ID: <E1dOUlN-00010D-Co@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1dOUlN-00010D-Co@gemulon.postgresql.org>
Permalink:  ../E1dOUlN-00010D-Co@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1dOUlN-00010D-Co@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix incorrect buffer-length argument to uloc_getDisplayName().
  In-Reply-To: <E1dOUlN-00010D-Co@gemulon.postgresql.org>
  References: <E1dOUlN-00010D-Co@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox