summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-08-03 16:19:18 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-08-03 16:19:18 +0000
commit7c29d369c5fc899c97b17725a34781f6a23090b0 (patch)
tree22320b70e8afdc515ee85168fbaa0e20d3d65f85 /searchlib
parentef0bb7481928dbd55104598e51dd268e44cd520e (diff)
Avoid copying 0 bytes from a nullptr
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/expression/resultnodes.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/expression/resultnodes.cpp b/searchlib/src/vespa/searchlib/expression/resultnodes.cpp
index 7fb3ab1b6cf..8f9f1b7ca06 100644
--- a/searchlib/src/vespa/searchlib/expression/resultnodes.cpp
+++ b/searchlib/src/vespa/searchlib/expression/resultnodes.cpp
@@ -438,7 +438,9 @@ void
RawResultNode::setBuffer(const void *buf, size_t sz)
{
_value.resize(sz + 1);
- memcpy(_value.data(), buf, sz);
+ if (sz > 0) {
+ memcpy(_value.data(), buf, sz);
+ }
_value.back() = 0;
_value.resize(sz);
}