Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitef9bf35

Browse files
committed
Repair unsafe/unportable snprintf usage in pg_restore.
warn_or_exit_horribly() was blithely passing a potentially-NULLstring pointer to a %s format specifier. That works (at leastto the extent of not crashing) on some platforms, but not all,and since we switched to our own snprintf.c it doesn't workfor us anywhere.Of the three string fields being handled this way here, I thinkthat only "owner" is supposed to be nullable ... but consideringthat this is error-reporting code, it has very little businessassuming anything, so put in defenses for all three.Per a crash observed on buildfarm member crake and thenreproduced here. Because of the portability aspect,back-patch to all supported versions.
1 parent027b5a3 commitef9bf35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,8 +1784,11 @@ warn_or_exit_horribly(ArchiveHandle *AH,
17841784
{
17851785
write_msg(modulename,"Error from TOC entry %d; %u %u %s %s %s\n",
17861786
AH->currentTE->dumpId,
1787-
AH->currentTE->catalogId.tableoid,AH->currentTE->catalogId.oid,
1788-
AH->currentTE->desc,AH->currentTE->tag,AH->currentTE->owner);
1787+
AH->currentTE->catalogId.tableoid,
1788+
AH->currentTE->catalogId.oid,
1789+
AH->currentTE->desc ?AH->currentTE->desc :"(no desc)",
1790+
AH->currentTE->tag ?AH->currentTE->tag :"(no tag)",
1791+
AH->currentTE->owner ?AH->currentTE->owner :"(no owner)");
17891792
}
17901793
AH->lastErrorStage=AH->stage;
17911794
AH->lastErrorTE=AH->currentTE;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp