pgsql: Correct off-by-one when reading from pipe - Mailing list pgsql-committers

From Stephen Frost
Subject pgsql: Correct off-by-one when reading from pipe
Date
Msg-id E1Uyk5E-0007iK-7U@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Correct off-by-one when reading from pipe

In pg_basebackup.c:reached_end_position(), we're reading from an
internal pipe with our own background process but we're possibly
reading more bytes than will actually fit into our buffer due to
an off-by-one error.  As we're reading from an internal pipe
there's no real risk here, but it's good form to not depend on
such convenient arrangements.

Bug spotted by the Coverity scanner.

Back-patch to 9.2 where this showed up.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/03010366b6fb61aac0998f234478cc745ff97b0c

Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c |    2 +-
1 file changed, 1 insertion(+), 1 deletion(-)


pgsql-committers by date:

Previous
From: Stephen Frost
Date:
Subject: pgsql: Check version before allocating PQExpBuffer
Next
From: Stephen Frost
Date:
Subject: pgsql: Correct off-by-one when reading from pipe