Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c52ad9c

Browse files
committed
Fix assert in logicalmsg_desc
The assert, introduced by 9f1cf97, 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
1 parent 40ca907 commit c52ad9c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/access/rmgrdesc/logicalmsgdesc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ logicalmsg_desc(StringInfo buf, XLogReaderState *record)
2828
char *message = xlrec->message + xlrec->prefix_size;
2929
char *sep = "";
3030

31-
Assert(prefix[xlrec->prefix_size] != '\0');
31+
Assert(prefix[xlrec->prefix_size - 1] == '\0');
3232

3333
appendStringInfo(buf, "%s, prefix \"%s\"; payload (%zu bytes): ",
3434
xlrec->transactional ? "transactional" : "non-transactional",

0 commit comments

Comments
 (0)