Re: BUG #14929: Unchecked AllocateDir() return value in restoreTwoPhaseData() - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #14929: Unchecked AllocateDir() return value in restoreTwoPhaseData()
Date
Msg-id CAB7nPqR0ui2hjmSTJ0PYc-YMOs_r7GX2OL9ehR07JCytxZex_w@mail.gmail.com
Whole thread Raw
In response to BUG #14929: Unchecked AllocateDir() return value inrestoreTwoPhaseData()  (bianpan2016@163.com)
Responses Re: BUG #14929: Unchecked AllocateDir() return value inrestoreTwoPhaseData()  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Re: BUG #14929: Unchecked AllocateDir() return value inrestoreTwoPhaseData()  (PanBian <bianpan2016@163.com>)
List pgsql-bugs
On Mon, Nov 27, 2017 at 6:31 PM,  <bianpan2016@163.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


pgsql-bugs by date:

Previous
From: Amit Langote
Date:
Subject: Re: BUG #14929: Unchecked AllocateDir() return value inrestoreTwoPhaseData()
Next
From: Michael Paquier
Date:
Subject: Re: BUG #14929: Unchecked AllocateDir() return value in restoreTwoPhaseData()