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@lists.postgresql.org
Subject: pgsql: Validate the OID argument of pg_import_system_collations().
Date: Mon, 08 Mar 2021 23:22:11 +0000
Message-ID: <E1lJPCV-00048c-9S@gemulon.postgresql.org> (raw)

Validate the OID argument of pg_import_system_collations().

"SELECT pg_import_system_collations(0)" caused an assertion failure.
With a random nonzero argument --- or indeed with zero, in non-assert
builds --- it would happily make pg_collation entries with garbage
values of collnamespace.  These are harmless as far as I can tell
(unless maybe the OID happens to become used for a schema, later on?).
In any case this isn't a security issue, since the function is
superuser-only.  But it seems like a gotcha for unwary DBAs, so let's
add a check that the given OID belongs to some schema.

Back-patch to v10 where this function was introduced.

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/37228ecde1f061ce47a2f60fcaa0f64a93af4ea8

Modified Files
--------------
src/backend/commands/collationcmds.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1lJPCV-00048c-9S@gemulon.postgresql.org>
Permalink:  ../E1lJPCV-00048c-9S@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lJPCV-00048c-9S@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: Validate the OID argument of pg_import_system_collations().
  In-Reply-To: <E1lJPCV-00048c-9S@gemulon.postgresql.org>
  References: <E1lJPCV-00048c-9S@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