pgsql: Fix unchecked return value from strdup

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix unchecked return value from strdup
Date: 2023-12-20 21:49:25
Message-ID: E1rG4RR-00B8R2-Dv@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)neon(dot)tech>
Reviewed-by: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Discussion: https://postgr.es/m/CC661D60-6F4C-474D-B9CF-E789ACA3CEFC@yesql.se
Backpatch-through: 16

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/30e54d5c5d8fceb7287162c116961fa0627544f5

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

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-12-20 21:49:45 pgsql: Fix unchecked return value from strdup
Previous Message Robert Haas 2023-12-20 18:11:17 Re: pgsql: Remove MSVC scripts