Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 105dbff

Browse filesBrowse files
committed
Check for fseeko() failure in pg_dump's _tarAddFile().
Coverity pointed out, not unreasonably, that we checked fseeko's result at every other call site but these. Failure to seek in the temp file (note this is NOT pg_dump's output file) seems quite unlikely, and even if it did happen the file length cross-check further down would probably detect the problem. Still, that's a poor excuse for not checking the result of a system call.
1 parent 011aa7c commit 105dbff
Copy full SHA for 105dbff

File tree

Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed

‎src/bin/pg_dump/pg_backup_tar.c

Copy file name to clipboardExpand all lines: src/bin/pg_dump/pg_backup_tar.c
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,12 +1094,16 @@ _tarAddFile(ArchiveHandle *AH, TAR_MEMBER *th)
10941094
/*
10951095
* Find file len & go back to start.
10961096
*/
1097-
fseeko(tmp, 0, SEEK_END);
1097+
if (fseeko(tmp, 0, SEEK_END) != 0)
1098+
exit_horribly(modulename, "error during file seek: %s\n",
1099+
strerror(errno));
10981100
th->fileLen = ftello(tmp);
10991101
if (th->fileLen < 0)
11001102
exit_horribly(modulename, "could not determine seek position in archive file: %s\n",
11011103
strerror(errno));
1102-
fseeko(tmp, 0, SEEK_SET);
1104+
if (fseeko(tmp, 0, SEEK_SET) != 0)
1105+
exit_horribly(modulename, "error during file seek: %s\n",
1106+
strerror(errno));
11031107

11041108
_tarWriteHeader(th);
11051109

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.