Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kG33i-0006Q9-Sh for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Sep 2020 16:34:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kG33h-0005RJ-GL for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Sep 2020 16:34:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kG33h-0005RC-9j for pgsql-hackers@lists.postgresql.org; Wed, 09 Sep 2020 16:34:57 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kG33a-00050U-W9 for pgsql-hackers@lists.postgresql.org; Wed, 09 Sep 2020 16:34:56 +0000 Received: from hnk.local (p12054-ipngn2901funabasi.chiba.ocn.ne.jp [153.212.171.54]) by oss.nttdata.com (Postfix) with ESMTPSA id E690D60292; Thu, 10 Sep 2020 01:34:48 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: Remove line length restriction in passwordFromFile() To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org, Fujii Masao References: <4187382.1598909041@sss.pgh.pa.us> <90aed8c6-a171-4cf7-4e4a-0d4d9593f6c5@oss.nttdata.com> <54742.1598973287@sss.pgh.pa.us> From: Fujii Masao Message-ID: <12eff40e-80df-244e-86b8-c60b0e88bc75@oss.nttdata.com> Date: Thu, 10 Sep 2020 01:34:48 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <54742.1598973287@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020/09/02 0:14, Tom Lane wrote: > Fujii Masao 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