From ba0f7b8066cb4dc8cb3cd4931e52aa94af40a709 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Sat, 6 Apr 2013 23:26:00 +0400 Subject: [PATCH] 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. --- src/node_crypto_bio.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_crypto_bio.cc b/src/node_crypto_bio.cc index d17ee21e78..d69eeb8f9b 100644 --- a/src/node_crypto_bio.cc +++ b/src/node_crypto_bio.cc @@ -279,7 +279,7 @@ void NodeBIO::Write(const char* data, size_t size) { // Go to next buffer if there still are some bytes to write if (left != 0) { - if (write_head_->next_->write_pos_ == kBufferLength) { + if (write_head_->write_pos_ == kBufferLength) { Buffer* next = new Buffer(); next->next_ = write_head_->next_; write_head_->next_ = next;