summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-01-21 19:47:36 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-01-21 19:47:36 +0000
commitaa0bfb11d05381a555c197a2ab26ee117c0758e6 (patch)
tree2231364d14330b9a9f61b8984bd13ecb555d3bad /document
parente7c1a4fc8c55795f707e83ce6d5607e0b41f5099 (diff)
Remove zero termination.
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/util/bytebuffer.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/document/src/vespa/document/util/bytebuffer.cpp b/document/src/vespa/document/util/bytebuffer.cpp
index 45d86cdc41e..0fbc6ca1c63 100644
--- a/document/src/vespa/document/util/bytebuffer.cpp
+++ b/document/src/vespa/document/util/bytebuffer.cpp
@@ -84,9 +84,8 @@ ByteBuffer::ByteBuffer(const ByteBuffer& rhs) :
_ownedBuffer()
{
if (rhs._len > 0 && rhs._buffer) {
- Alloc buf = Alloc::alloc(rhs._len + 1);
+ Alloc buf = Alloc::alloc(rhs._len);
memcpy(buf.get(), rhs._buffer, rhs._len);
- static_cast<char *>(buf.get())[rhs._len] = 0;
_ownedBuffer = std::move(buf);
_buffer = static_cast<const char *>(_ownedBuffer.get());
}
@@ -97,9 +96,8 @@ ByteBuffer::~ByteBuffer() = default;
ByteBuffer* ByteBuffer::copyBuffer(const char* buffer, uint32_t len)
{
if (buffer && len) {
- Alloc newBuf = Alloc::alloc(len + 1);
+ Alloc newBuf = Alloc::alloc(len);
memcpy(newBuf.get(), buffer, len);
- static_cast<char *>(newBuf.get())[len] = 0;
return new ByteBuffer(std::move(newBuf), len);
} else {
return nullptr;