pgsql: Correct off-by-one when reading from pipe

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Correct off-by-one when reading from pipe
Date: 2013-07-15 14:49:23
Message-ID: E1Uyk5b-0007jX-9o@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/a3957ac156da7e31da46a2d8e3b6c7669333cc99

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

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2013-07-15 14:52:35 pgsql: vacuumlo: Use a cursor to limit client-side memory usage.
Previous Message Stephen Frost 2013-07-15 14:49:17 pgsql: Correct off-by-one when reading from pipe