summaryrefslogtreecommitdiffstats
path: root/src/lib/util
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2022-01-25 13:28:04 +0100
committerAndrei Pavel <andrei@isc.org>2022-01-25 13:31:26 +0100
commite1b2adad9069342f0f4dd9dc611478b56f86dbe5 (patch)
tree19c9c87c523946a36efd9064a8986ffc5bc5b4d1 /src/lib/util
parent[#2225] allow PGPASSWORD to be set from outside admin-utils.sh (diff)
downloadkea-e1b2adad9069342f0f4dd9dc611478b56f86dbe5.tar.xz
kea-e1b2adad9069342f0f4dd9dc611478b56f86dbe5.zip
[#2283] exit early when packing a zero length OpaqueDataTuple
Diffstat (limited to 'src/lib/util')
-rw-r--r--src/lib/util/buffer.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/util/buffer.h b/src/lib/util/buffer.h
index 019d373af7..b1d5204538 100644
--- a/src/lib/util/buffer.h
+++ b/src/lib/util/buffer.h
@@ -548,6 +548,10 @@ public:
/// \param data A pointer to the data to be copied into the buffer.
/// \param len The length of the data in bytes.
void writeData(const void *data, size_t len) {
+ if (len == 0) {
+ return;
+ }
+
ensureAllocated(size_ + len);
static_cast<void>(std::memmove(buffer_ + size_, data, len));
size_ += len;