Re: Unchecked strdup leading to segfault in pg_dump

From: "Tristan Partin" <tristan(at)neon(dot)tech>
To: "Daniel Gustafsson" <daniel(at)yesql(dot)se>
Cc: "Postgres hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Unchecked strdup leading to segfault in pg_dump
Date: 2023-12-20 15:39:55
Message-ID: CXT9VSTJBTZG.284W25B3BM113@neon.tech
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed Dec 20, 2023 at 8:52 AM CST, Daniel Gustafsson wrote:
> 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.

Looks good to me.

--
Tristan Partin
Neon (https://neon.tech)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-12-20 15:43:55 Re: Remove MSVC scripts from the tree
Previous Message Nathan Bossart 2023-12-20 15:33:42 Re: introduce dynamic shared memory registry