From: Francis Dupont Date: Tue, 8 Jun 2021 20:35:37 +0000 (+0200) Subject: [(no branch, rebasing 1909-gss_tsig-hook)] [#1909] Fixed Coverity complain about... X-Git-Tag: Kea-1.9.9~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5d68f6182d787d56ecdaae7734ccecea20f56f0;p=thirdparty%2Fkea.git [(no branch, rebasing 1909-gss_tsig-hook)] [#1909] Fixed Coverity complain about TKEY second constructor --- diff --git a/src/lib/dns/rdata/generic/tkey_249.cc b/src/lib/dns/rdata/generic/tkey_249.cc index 886eb40375..435a345ac5 100644 --- a/src/lib/dns/rdata/generic/tkey_249.cc +++ b/src/lib/dns/rdata/generic/tkey_249.cc @@ -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(key), - static_cast(key) + key_len), - other_data_(static_cast(other_data), - static_cast(other_data) + other_len) + key_(key_len > 0 ? + vector(static_cast(key), + static_cast(key) + key_len) : + vector(key_len)), + other_data_(other_len > 0 ? + vector(static_cast(other_data), + static_cast(other_data) + + other_len) : + vector(other_len)) {} /// \brief Common part of toWire methods. diff --git a/src/lib/dns/rdataclass.cc b/src/lib/dns/rdataclass.cc index 3a3de4aa33..3cb61ade93 100644 --- a/src/lib/dns/rdataclass.cc +++ b/src/lib/dns/rdataclass.cc @@ -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(key), - static_cast(key) + key_len), - other_data_(static_cast(other_data), - static_cast(other_data) + other_len) + key_(key_len > 0 ? + vector(static_cast(key), + static_cast(key) + key_len) : + vector(key_len)), + other_data_(other_len > 0 ? + vector(static_cast(other_data), + static_cast(other_data) + + other_len) : + vector(other_len)) {} /// \brief Common part of toWire methods.