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 1kD7zu-0006aw-V8 for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Sep 2020 15:14: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 1kD7zs-0004vp-Nz for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Sep 2020 15:14:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kD7zs-0004vg-Gw for pgsql-hackers@lists.postgresql.org; Tue, 01 Sep 2020 15:14:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kD7zm-0006ia-4P for pgsql-hackers@lists.postgresql.org; Tue, 01 Sep 2020 15:14:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 081FEl2M054743; Tue, 1 Sep 2020 11:14:48 -0400 From: Tom Lane To: Fujii Masao cc: pgsql-hackers@lists.postgresql.org, Fujii Masao Subject: Re: Remove line length restriction in passwordFromFile() In-reply-to: References: <4187382.1598909041@sss.pgh.pa.us> <90aed8c6-a171-4cf7-4e4a-0d4d9593f6c5@oss.nttdata.com> Comments: In-reply-to Fujii Masao message dated "Tue, 01 Sep 2020 14:41:09 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <54741.1598973287.1@sss.pgh.pa.us> Date: Tue, 01 Sep 2020 11:14:47 -0400 Message-ID: <54742.1598973287@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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! regards, tom lane