Correct some code in pg_restore when reading the header of a tar archive:
authorNeil Conway <neilc@samurai.com>
Wed, 22 Jun 2005 02:02:09 +0000 (02:02 +0000)
committerNeil Conway <neilc@samurai.com>
Wed, 22 Jun 2005 02:02:09 +0000 (02:02 +0000)
commit2379896e19c74ee048b159c4761165dd5ec7f095
treeb55fc0a5a30f969244b1fb77d36dc6a49c7b88ab
parente7bc44c77cd70b426e03945c44ae090a315457d9
Correct some code in pg_restore when reading the header of a tar archive:

(1) The code doesn't initialize `sum', so the initial "does the checksum
    match?" test is wrong.

(2) The loop that is intended to check for a "null block" just checks
    the first byte of the tar block 512 times, rather than each of the
    512 bytes one time (!), which I'm guessing was the intent.

It was only through sheer luck that this worked in the first place.

Per Coverity static analysis performed by EnterpriseDB.
src/bin/pg_dump/pg_backup_tar.c