Unchecked strdup leading to segfault in pg_dump

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Unchecked strdup leading to segfault in pg_dump
Date: 2023-12-20 14:52:56
Message-ID: CC661D60-6F4C-474D-B9CF-E789ACA3CEFC@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While looking at something else I noticed that pg_dump performs strdup without
checking the returned pointer, which will segfault in hasSuffix() in case of
OOM. The attached, which should be backpatched to 16, changes to using
pg_strdup instead which handles it.

--
Daniel Gustafsson

Attachment Content-Type Size
pg_dump_strdup.diff application/octet-stream 453 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-12-20 15:33:42 Re: introduce dynamic shared memory registry
Previous Message Daniel Gustafsson 2023-12-20 14:28:56 Re: ci: Build standalone INSTALL file