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.
pull/5010/head
Fedor Indutny 2013-04-06 23:26:00 +04:00
parent 62a214268a
commit 798d1772c0
1 changed files with 1 additions and 1 deletions

View File

@ -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 // Go to next buffer if there still are some bytes to write
if (left != 0) { if (left != 0) {
if (write_head_->next_->write_pos_ == kBufferLength) { if (write_head_->write_pos_ == kBufferLength) {
Buffer* next = new Buffer(); Buffer* next = new Buffer();
next->next_ = write_head_->next_; next->next_ = write_head_->next_;
write_head_->next_ = next; write_head_->next_ = next;