diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-08-06 01:38:15 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-08-06 01:38:15 +0000 |
commit | fcb9535e8a3576f6bfcc54bdc52c195d46f32b53 (patch) | |
tree | 583e825ba89968d1d4a9297045b5f29658f21cb6 /src/bin/pg_dump/pg_backup_files.c | |
parent | df9ea6a1f1c283b342d1b6e80968fc09310a2f67 (diff) | |
download | postgresql-fcb9535e8a3576f6bfcc54bdc52c195d46f32b53.tar.gz postgresql-fcb9535e8a3576f6bfcc54bdc52c195d46f32b53.zip |
Fix pg_restore to guard against unexpected EOF while reading an archive file.
Per report and partial patch from Chad Wagner.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_files.c')
-rw-r--r-- | src/bin/pg_dump/pg_backup_files.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/bin/pg_dump/pg_backup_files.c b/src/bin/pg_dump/pg_backup_files.c index 2b292aa5792..6520ca227aa 100644 --- a/src/bin/pg_dump/pg_backup_files.c +++ b/src/bin/pg_dump/pg_backup_files.c @@ -20,7 +20,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.32 2007/03/18 16:50:44 neilc Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.33 2007/08/06 01:38:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -395,9 +395,10 @@ _ReadByte(ArchiveHandle *AH) lclContext *ctx = (lclContext *) AH->formatData; int res; - res = fgetc(AH->FH); - if (res != EOF) - ctx->filePos += 1; + res = getc(AH->FH); + if (res == EOF) + die_horribly(AH, modulename, "unexpected end of file\n"); + ctx->filePos += 1; return res; } |