diff --git a/contracts/Buffer.sol b/contracts/Buffer.sol index 6ef6039..e4004fd 100644 --- a/contracts/Buffer.sol +++ b/contracts/Buffer.sol @@ -91,7 +91,7 @@ library Buffer { function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) { require(len <= data.length); - if (off + len + buf.buf.length > buf.capacity) { + if (off + len > buf.capacity) { resize(buf, max(buf.capacity, len + off) * 2); }