Re: BUG #14929: Unchecked AllocateDir() return value in restoreTwoPhaseData()

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: bianpan2016(at)163(dot)com
Cc: PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14929: Unchecked AllocateDir() return value in restoreTwoPhaseData()
Date: 2017-11-27 10:53:30
Message-ID: CAB7nPqR0ui2hjmSTJ0PYc-YMOs_r7GX2OL9ehR07JCytxZex_w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Nov 27, 2017 at 6:31 PM, <bianpan2016(at)163(dot)com> wrote:
> AllocateDir() will return a NULL pointer if it fails to open the specified
> directory. However, in function restoreTwoPhaseData(), its return value is
> not checked. This may result in a NULL pointer dereference when trying to
> free it (see line 1759).

You are missing the fact that ReadDir goes through ReadDirExtended,
which drops an ERROR log if the folder allocated is NULL.
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2017-11-27 10:57:41 Re: BUG #14929: Unchecked AllocateDir() return value in restoreTwoPhaseData()
Previous Message Amit Langote 2017-11-27 10:35:35 Re: BUG #14929: Unchecked AllocateDir() return value in restoreTwoPhaseData()