Re: Remove line length restriction in passwordFromFile() - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Remove line length restriction in passwordFromFile()
Date
Msg-id 12eff40e-80df-244e-86b8-c60b0e88bc75@oss.nttdata.com
Whole thread Raw
In response to Re: Remove line length restriction in passwordFromFile()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Remove line length restriction in passwordFromFile()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

On 2020/09/02 0:14, Tom Lane wrote:
> Fujii Masao <masao.fujii@oss.nttdata.com> writes:
>> The patch looks good to me, except the following minor thing.
>> +        if (fgets(buf.data + buf.len, buf.maxlen - buf.len - 1, fp) == NULL)
>> IIUC fgets() reads the data with the specified size - 1, so ISTM that -1 of
>> "buf.maxlen - buf.len - 1" is not necessary.
> 
> Good point, I was being unduly conservative.  Thanks for reviewing
> the patch!

Thanks for committing the patch!

The patch was back-patched to v13, but v13 release note still has the following item.

     Tighten libpq's overlength-line handling and comment detection for .pgpass files (Fujii Masao)

This should be changed to the following or something?

     Teach libpq to handle arbitrary-length lines in .pgpass files (Tom Lane)

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Minor fixes for upcoming version 13
Next
From: Fujii Masao
Date:
Subject: Re: Inconsistent Japanese name order in v13 contributors list