diff options
author | Tom <[email protected]> | 2019-07-05 20:56:40 +0100 |
---|---|---|
committer | Tom <[email protected]> | 2019-07-05 23:27:08 +0100 |
commit | a9e4eb9ce808ba5d0b6ab69ef7cfc2d15050713d (patch) | |
tree | 1d39090db4a938417e5c722ca52a536c70b49a5e /src/lib/base | |
parent | 596892be9ae6a3b04f6d8222fdc7a4aef75ca83c (diff) |
Skip allocation if OctetString is constructed with empty string.
Diffstat (limited to 'src/lib/base')
-rw-r--r-- | src/lib/base/symkey.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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)); + } } /* |