]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix assert in logicalmsg_desc
authorTomas Vondra <tomas.vondra@postgresql.org>
Tue, 16 Aug 2022 21:52:10 +0000 (23:52 +0200)
committerTomas Vondra <tomas.vondra@postgresql.org>
Tue, 16 Aug 2022 22:13:42 +0000 (00:13 +0200)
commitbe6aadf07d005c292ac05e4b80761f7962facb71
treed56b25070f0216aa06f9968b0a526c8241a2d01a
parentac222a3c374080f241936d2e47149d01ea006d6d
Fix assert in logicalmsg_desc

The assert, introduced by 9f1cf97bb5, is intended to check if the prefix
is terminated by a \0 byte, but it has two flaws. Firstly, prefix_size
includes the \0 byte, so prefix[prefix_size] points to the byte after
the null byte. Secondly, the check ensures the byte is not equal \0,
while it should be checking the opposite.

Backpatch-through: 14
Discussion: https://postgr.es/m/b99b6101-2f14-3796-3dfa-4a6cd7d4326d@enterprisedb.com
src/backend/access/rmgrdesc/logicalmsgdesc.c