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

From: PanBian <bianpan2016(at)163(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14929: Unchecked AllocateDir() return value in restoreTwoPhaseData()
Date: 2017-11-27 11:44:10
Message-ID: 20171127114410.GA30545@bp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(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.

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Frank van Vugt 2017-11-27 14:04:19 minor annoyance - search_path not reset in/after dump/restore
Previous Message PanBian 2017-11-27 11:36:52 Re: BUG #14928: Unchecked SearchSysCacheCopy1() return value