pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix unchecked return value from strdup
Date: Wed, 20 Dec 2023 21:49:45 +0000
Message-ID: <E1rG4Rk-00B8SB-Nx@gemulon.postgresql.org> (raw)

Fix unchecked return value from strdup

The pg_dump compression was using strdup() instead of pg_strdup()
and failed to check the returned pointer for out-of-memory before
dereferencing it. Fix by using pg_strdup() instead which probably
was the intention here in the original patch.

Backpatch to v16 where pg_dump compression was introduced.

Reviewed-by: Tristan Partin <tristan@neon.tech>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://postgr.es/m/CC661D60-6F4C-474D-B9CF-E789ACA3CEFC@yesql.se
Backpatch-through: 16

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5b5db413d26ff49e9fd6506258a838ba0a9ea151

Modified Files
--------------
src/bin/pg_dump/compress_io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



view thread (2+ messages)

Message-ID: <E1rG4Rk-00B8SB-Nx@gemulon.postgresql.org>
Permalink:  ../E1rG4Rk-00B8SB-Nx@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rG4Rk-00B8SB-Nx@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: dgustafsson@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix unchecked return value from strdup
  In-Reply-To: <E1rG4Rk-00B8SB-Nx@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