From: Michael Paquier <michael@paquier.xyz>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix parsing of integer values for connection parameters in libpq
Date: Tue, 22 Oct 2019 19:05:53 +0900
Message-ID: <20191022100553.GA3908@paquier.xyz> (raw)
In-Reply-To: <ec64956b-4597-56b6-c3db-457d15250fe4@2ndquadrant.com>
References: <E1iMNH3-0008Tp-T0@gemulon.postgresql.org>
<ec64956b-4597-56b6-c3db-457d15250fe4@2ndquadrant.com>
On Tue, Oct 22, 2019 at 10:05:45AM +0200, Peter Eisentraut wrote:
> You probably want something like
>
> if (end && *end != ...)
Yes, it looks like a brain fade here. Conversion failures are tracked
before that, so strtol() would not return NULL for endptr. The first
part could just be removed as per the attached.
--
Michael
Attachments:libpq-parse-fix.patch (text/x-diff, 621B) downloaddiff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.cindex 9af830321c..0eeabb8b43 100644--- a/src/interfaces/libpq/fe-connect.c+++ b/src/interfaces/libpq/fe-connect.c@@ -1713,10 +1713,10 @@ parse_int_param(const char *value, int *result, PGconn *conn,
* Skip any trailing whitespace; if anything but whitespace remains before
* the terminating character, fail
*/
- while (*end && *end != '\0' && isspace((unsigned char) *end))+ while (*end != '\0' && isspace((unsigned char) *end))
end++;
- if (*end && *end != '\0')+ if (*end != '\0')
goto error;
*result = numval;
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, peter.eisentraut@2ndquadrant.com
Subject: Re: pgsql: Fix parsing of integer values for connection parameters in libpq
In-Reply-To: <20191022100553.GA3908@paquier.xyz>
References: <E1iMNH3-0008Tp-T0@gemulon.postgresql.org> <ec64956b-4597-56b6-c3db-457d15250fe4@2ndquadrant.com> <20191022100553.GA3908@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox