A suspicious code in pgoutput_startup().

Started by Yugo Nagataover 8 years ago3 messageshackers
Jump to latest
#1Yugo Nagata
nagata@sraoss.co.jp

Hi,

I found a suspicious code in pgoutput_startup().

175 /* Check if we support requested protocol */
176 if (data->protocol_version != LOGICALREP_PROTO_VERSION_NUM)
177 ereport(ERROR,
178 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
179 errmsg("client sent proto_version=%d but we only support protocol %d or lower",
180 data->protocol_version, LOGICALREP_PROTO_VERSION_NUM)));

Although the if condition is not-equal, the error message says
"we only support protocol %d or lower". Is this intentional?
Or should this be fixed as below?

176 if (data->protocol_version > LOGICALREP_PROTO_VERSION_NUM)

Attached is a simple patch in case of fixing.

Regards,

--
Yugo Nagata <nagata@sraoss.co.jp>

Attachments:

pgoutput.patchtext/x-diff; name=pgoutput.patchDownload+1-1
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Yugo Nagata (#1)
Re: A suspicious code in pgoutput_startup().

On 7/27/17 20:52, Yugo Nagata wrote:

175 /* Check if we support requested protocol */
176 if (data->protocol_version != LOGICALREP_PROTO_VERSION_NUM)
177 ereport(ERROR,
178 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
179 errmsg("client sent proto_version=%d but we only support protocol %d or lower",
180 data->protocol_version, LOGICALREP_PROTO_VERSION_NUM)));

Although the if condition is not-equal, the error message says
"we only support protocol %d or lower". Is this intentional?
Or should this be fixed as below?

176 if (data->protocol_version > LOGICALREP_PROTO_VERSION_NUM)

Attached is a simple patch in case of fixing.

Fixed, thanks.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Yugo Nagata
nagata@sraoss.co.jp
In reply to: Peter Eisentraut (#2)
Re: A suspicious code in pgoutput_startup().

On Tue, 15 Aug 2017 16:23:35 -0400
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote:

On 7/27/17 20:52, Yugo Nagata wrote:

175 /* Check if we support requested protocol */
176 if (data->protocol_version != LOGICALREP_PROTO_VERSION_NUM)
177 ereport(ERROR,
178 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
179 errmsg("client sent proto_version=%d but we only support protocol %d or lower",
180 data->protocol_version, LOGICALREP_PROTO_VERSION_NUM)));

Although the if condition is not-equal, the error message says
"we only support protocol %d or lower". Is this intentional?
Or should this be fixed as below?

176 if (data->protocol_version > LOGICALREP_PROTO_VERSION_NUM)

Attached is a simple patch in case of fixing.

Fixed, thanks.

Thanks, too!

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Yugo Nagata <nagata@sraoss.co.jp>

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers