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

From PanBian
Subject Re: BUG #14929: Unchecked AllocateDir() return value inrestoreTwoPhaseData()
Date
Msg-id 20171127114410.GA30545@bp
Whole thread Raw
In response to Re: BUG #14929: Unchecked AllocateDir() return value in restoreTwoPhaseData()  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: BUG #14929: Unchecked AllocateDir() return value in restoreTwoPhaseData()
List pgsql-bugs
On Mon, Nov 27, 2017 at 07:53:30PM +0900, Michael Paquier wrote:
> 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.

You are right. Its my carelessness. ReadDir will not return back on a
NULL dir parameter. The code is bug free. Sorry for the trouble.

Thank you all,
Pan Bian

> -- 
> Michael



pgsql-bugs by date:

Previous
From: PanBian
Date:
Subject: Re: BUG #14928: Unchecked SearchSysCacheCopy1() return value
Next
From: Frank van Vugt
Date:
Subject: minor annoyance - search_path not reset in/after dump/restore