mirror of https://github.com/nodejs/node.git
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
parent
62a214268a
commit
798d1772c0
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue