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 Coverity warning about contrib/pgcrypto's mdc_finish().
Date: Fri, 30 Jan 2015 18:05:42 +0000
Message-ID: <E1YHFws-0001VD-SD@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix Coverity warning about contrib/pgcrypto's mdc_finish().

Coverity points out that mdc_finish returns a pointer to a local buffer
(which of course is gone as soon as the function returns), leaving open
a risk of misbehaviors possibly as bad as a stack overwrite.

In reality, the only possible call site is in process_data_packets()
which does not examine the returned pointer at all.  So there's no
live bug, but nonetheless the code is confusing and risky.  Refactor
to avoid the issue by letting process_data_packets() call mdc_finish()
directly instead of going through the pullf_read() API.

Although this is only cosmetic, it seems good to back-patch so that
the logic in pgp-decrypt.c stays in sync across all branches.

Marko Kreen

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/8f51c432cd6cc21f36e9dd9b15695869e73cd0d0

Modified Files
--------------
contrib/pgcrypto/pgp-decrypt.c |   49 ++++++++++++++++------------------------
1 file changed, 19 insertions(+), 30 deletions(-)


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


view thread (6+ messages)  latest in thread

Message-ID: <E1YHFws-0001VD-SD@gemulon.postgresql.org>
Permalink:  ../E1YHFws-0001VD-SD@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1YHFws-0001VD-SD@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 Coverity warning about contrib/pgcrypto's mdc_finish().
  In-Reply-To: <E1YHFws-0001VD-SD@gemulon.postgresql.org>
  References: <E1YHFws-0001VD-SD@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