pgsql: Fix assert in logicalmsg_desc

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix assert in logicalmsg_desc
Date: 2022-08-16 22:20:12
Message-ID: E1oO4ux-0015sw-9E@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c52ad9c4efdb91ce274c65b1acdb350e439c7b2d

Modified Files
--------------
src/backend/access/rmgrdesc/logicalmsgdesc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2022-08-16 22:20:22 pgsql: Fix assert in logicalmsg_desc
Previous Message Daniel Gustafsson 2022-08-16 21:10:48 pgsql: doc: Remove reference to tty libpq connstring param