Content-Length: 258203 | pFad | http://github.com/postgrespro/postgres/commit/9e26326ad6cd11ac32d11e6cbeb613443f361da6

19 pg_upgrade: fix off-by-one mistake in snprintf · postgrespro/postgres@9e26326 · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/9e26326ad6cd11ac32d11e6cbeb613443f361da6

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy