Commit ff03112b authored by Alvaro Herrera's avatar Alvaro Herrera

Fix off-by-one bug in XactLogCommitRecord

Commit 1eb6d652 introduced zeroed alignment bytes in the GID field
of commit/abort WAL records.  Fixup commit cf5a1890 later changed
that representation into a regular cstring with a single terminating
zero byte, but it also introduced an off-by-one mistake.  Fix that.

Author: Nikhil Sontakke
Reported-by: Nikhil Sontakke
Discussion: https://postgr.es/m/CAMGcDxey6dG1DP34_tJMoWPcp5sPJUAL4K5CayUUXLQSx2GQpA@mail.gmail.com
parent dad8bed0
...@@ -5365,7 +5365,7 @@ XactLogCommitRecord(TimestampTz commit_time, ...@@ -5365,7 +5365,7 @@ XactLogCommitRecord(TimestampTz commit_time,
{ {
XLogRegisterData((char *) (&xl_twophase), sizeof(xl_xact_twophase)); XLogRegisterData((char *) (&xl_twophase), sizeof(xl_xact_twophase));
if (xl_xinfo.xinfo & XACT_XINFO_HAS_GID) if (xl_xinfo.xinfo & XACT_XINFO_HAS_GID)
XLogRegisterData((char *) twophase_gid, strlen(twophase_gid)); XLogRegisterData((char *) twophase_gid, strlen(twophase_gid) + 1);
} }
if (xl_xinfo.xinfo & XACT_XINFO_HAS_ORIGIN) if (xl_xinfo.xinfo & XACT_XINFO_HAS_ORIGIN)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment