From a9e4eb9ce808ba5d0b6ab69ef7cfc2d15050713d Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 5 Jul 2019 20:56:40 +0100 Subject: Skip allocation if OctetString is constructed with empty string. --- src/lib/base/symkey.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/lib/base') diff --git a/src/lib/base/symkey.cpp b/src/lib/base/symkey.cpp index 115c3ea67..4b853d995 100644 --- a/src/lib/base/symkey.cpp +++ b/src/lib/base/symkey.cpp @@ -26,8 +26,11 @@ OctetString::OctetString(RandomNumberGenerator& rng, */ OctetString::OctetString(const std::string& hex_string) { - m_data.resize(1 + hex_string.length() / 2); - m_data.resize(hex_decode(m_data.data(), hex_string)); + if(!hex_string.empty()) + { + m_data.resize(1 + hex_string.length() / 2); + m_data.resize(hex_decode(m_data.data(), hex_string)); + } } /* -- cgit v1.2.3