2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 05:27:55 +00:00

[(no branch, rebasing 1909-gss_tsig-hook)] [#1909] Fixed Coverity complain about TKEY second constructor

This commit is contained in:
Francis Dupont 2021-06-08 22:35:37 +02:00
parent 9c7a9d1dd8
commit d5d68f6182
2 changed files with 18 additions and 8 deletions

View File

@ -69,10 +69,15 @@ struct TKEYImpl {
const void* key, size_t other_len, const void* other_data) :
algorithm_(algorithm), inception_(inception), expire_(expire),
mode_(mode), error_(error),
key_(static_cast<const uint8_t*>(key),
static_cast<const uint8_t*>(key) + key_len),
other_data_(static_cast<const uint8_t*>(other_data),
static_cast<const uint8_t*>(other_data) + other_len)
key_(key_len > 0 ?
vector<uint8_t>(static_cast<const uint8_t*>(key),
static_cast<const uint8_t*>(key) + key_len) :
vector<uint8_t>(key_len)),
other_data_(other_len > 0 ?
vector<uint8_t>(static_cast<const uint8_t*>(other_data),
static_cast<const uint8_t*>(other_data) +
other_len) :
vector<uint8_t>(other_len))
{}
/// \brief Common part of toWire methods.

View File

@ -5217,10 +5217,15 @@ struct TKEYImpl {
const void* key, size_t other_len, const void* other_data) :
algorithm_(algorithm), inception_(inception), expire_(expire),
mode_(mode), error_(error),
key_(static_cast<const uint8_t*>(key),
static_cast<const uint8_t*>(key) + key_len),
other_data_(static_cast<const uint8_t*>(other_data),
static_cast<const uint8_t*>(other_data) + other_len)
key_(key_len > 0 ?
vector<uint8_t>(static_cast<const uint8_t*>(key),
static_cast<const uint8_t*>(key) + key_len) :
vector<uint8_t>(key_len)),
other_data_(other_len > 0 ?
vector<uint8_t>(static_cast<const uint8_t*>(other_data),
static_cast<const uint8_t*>(other_data) +
other_len) :
vector<uint8_t>(other_len))
{}
/// \brief Common part of toWire methods.