]> granicus.if.org Git - postgresql/commit
Correct off-by-one when reading from pipe
authorStephen Frost <sfrost@snowman.net>
Mon, 15 Jul 2013 14:42:27 +0000 (10:42 -0400)
committerStephen Frost <sfrost@snowman.net>
Mon, 15 Jul 2013 14:48:08 +0000 (10:48 -0400)
commita3957ac156da7e31da46a2d8e3b6c7669333cc99
treea26713732846904c86f4380019907bf76e428f82
parent89c09fe02d9aa77aea28525b97229f61f1d5e471
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.
src/bin/pg_basebackup/pg_basebackup.c