Use ArchiveHandle.lookaheadSize instead of a hardcoded 512

_discoverArchiveFormat allocates the lookahead buffer used to identify
the archive format and records its size in AH->lookaheadSize, but then
used a hardcoded size in the two plades that need it.  Use the field
instead, so that the buffer and its size cannot drift apart and risk
out-of-bound reads.

Author: Aleksander Alekseev <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Reviewed-by: Daniel Gustafsson <[email protected]>
Discussion: 
https://postgr.es/m/caj7c6tpqlzomk3hprglqvrog9bcy4sv6buc_wx54fyqurkb...@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8646214ee20b3754d69f9d087baa7eeb1b7e1d0b

Modified Files
--------------
src/bin/pg_dump/pg_backup_archiver.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

Reply via email to