Correct some code in pg_restore when reading the header of a tar archive:

Neil Conway <neilc@samurai.com>

Commit: 5ba26d48fc03eef2083768672548bde0bb6ddbbe
Author: Neil Conway <neilc@samurai.com>
Date: 2005-06-22T02:02:09Z
Releases: 8.0.4
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.

Files

PathChange+/−
src/bin/pg_dump/pg_backup_tar.c modified +9 −9