pg_restore: fix bogosity

From: Neil Conway <neilc(at)samurai(dot)com>
To: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: pg_restore: fix bogosity
Date: 2005-06-21 02:09:42
Message-ID: 42B776E6.6040202@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

The Coverity tool picked up some rather bizarre code in _tarGetHeader in
pg_backup_tar.c:

(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.

Attached is a patch that I believe should implement what the author
intended. Barring any objections, I'll apply this to HEAD and back
branches today or tomorrow.

-Neil

Attachment Content-Type Size
pg_dump_tar_fix-1.patch text/x-patch 2.0 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-06-21 03:20:00 Re: code cleanup for tz
Previous Message Neil Conway 2005-06-21 00:01:20 Re: code cleanup for tz