| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: pg_rewind: Fix buffer size passed when building WAL file name |
| Date: | 2026-11-26 00:37:17 |
| Message-ID: | C62E58A5-D705-4C6E-A7FA-1EB0D2DB1AAF@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Nov 26, 2026, at 01:04, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> In pg_rewind findLastCheckpoint() there is a buffer size mismatch when composing a WAL file name. You can't actually overflow the buffer, so it's harmless, but when playing with compiler annotations, I see this getting flagged, because it's rather obviously incorrect on some level, so I think it's worth fixing. See attached patch for details.
> <0001-pg_rewind-Fix-buffer-size-passed-when-building-WAL-f.patch>
I see this patch actually two things:
1. Replacing MAXFNAMELEN with MAXPGPATH. As xlogfname is going to store a path rather than just a file name, the fix is reasonable, though we cannot overflow it today.
2. The current code uses snprintf() + XLogFileName(), while this patch changes it to use XLogFilePath(), which makes the code easier to read and looks like a good cleanup.
So, the patch looks good to me.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2026-11-26 00:39:15 | Re: repack: clarify final phase of concurrent mode in file header comment |
| Previous Message | Zhijie Hou | 2026-11-26 00:32:56 | Re: Fix LogStandbySnapshot() race during logical decoding activation |