Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9e26326

Browse files
committed
pg_upgrade: fix off-by-one mistake in snprintf
snprintf counts trailing NUL towards the char limit. Failing to account for that was causing an invalid value to be passed to pg_resetxlog -l, aborting the upgrade process.
1 parent c1494b7 commit 9e26326

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/pg_upgrade/controldata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
425425
{
426426
if (got_log_id && got_log_seg)
427427
{
428-
snprintf(cluster->controldata.nextxlogfile, 24, "%08X%08X%08X",
428+
snprintf(cluster->controldata.nextxlogfile, 25, "%08X%08X%08X",
429429
tli, logid, segno);
430430
got_nextxlogfile = true;
431431
}

0 commit comments

Comments
 (0)