Skip to content

Commit 798d177

Browse files
committed
crypto: fix changing buffers in bio
We should go to next buffer if *current* one is full, not the next one. Otherwise we may hop through buffers and written data will become interleaved, which will lead to failure.
1 parent 62a2142 commit 798d177

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_crypto_bio.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ void NodeBIO::Write(const char* data, size_t size) {
279279

280280
// Go to next buffer if there still are some bytes to write
281281
if (left != 0) {
282-
if (write_head_->next_->write_pos_ == kBufferLength) {
282+
if (write_head_->write_pos_ == kBufferLength) {
283283
Buffer* next = new Buffer();
284284
next->next_ = write_head_->next_;
285285
write_head_->next_ = next;

0 commit comments

Comments
 (0)