Skip to content

Commit 343abbf

Browse files
author
Antonin Houska
committed
Be cautious about page header after having processed unsentBuffer.
1 parent ec1dc9b commit 343abbf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/wbfilter.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,15 @@ WriteNoopRecord(FilterData *fl, ReplMessage *msg)
493493
memcpy(fl->unsentBuffer, fl->buffer + copied, amount);
494494
copied += amount;
495495
toCopy -= amount;
496-
targetpos = 0;
496+
497+
/*
498+
* In the corner case of msg->data starting with page header make
499+
* sure that we do not overwrite the header.
500+
*/
501+
if (fl->headerPos == 0)
502+
targetpos = fl->headerLen;
503+
else
504+
targetpos = 0;
497505
}
498506
/*
499507
* Copy up to next page header or to end of buffer.

0 commit comments

Comments
 (0)