diff options
author | Jeffrey Walton <noloader@gmail.com> | 2020-05-10 01:25:39 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2020-05-10 01:25:39 -0400 |
commit | 680956e13436e29ebcd85dee776260fd3de89846 (patch) | |
tree | 2d5632b113c4d3f181c645447090b5eddb5a0776 /secblock.h | |
parent | 7a8e241c7c0e75329793f36681894f8dab41fb37 (diff) | |
download | cryptopp-git-680956e13436e29ebcd85dee776260fd3de89846.tar.gz |
Clean GCC 10 Analyzer warnings
Diffstat (limited to 'secblock.h')
-rw-r--r-- | secblock.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -748,7 +748,8 @@ public: SecBlock(const SecBlock<T, A> &t)
: m_mark(t.m_mark), m_size(t.m_size), m_ptr(m_alloc.allocate(t.m_size, NULLPTR)) {
CRYPTOPP_ASSERT((!t.m_ptr && !m_size) || (t.m_ptr && m_size));
- if (t.m_ptr) {memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, t.m_size*sizeof(T));}
+ if (m_ptr && t.m_ptr)
+ memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, t.m_size*sizeof(T));
}
/// \brief Construct a SecBlock from an array of elements.
@@ -764,7 +765,7 @@ public: CRYPTOPP_ASSERT((!m_ptr && !m_size) || (m_ptr && m_size));
if (ptr && m_ptr)
memcpy_s(m_ptr, m_size*sizeof(T), ptr, len*sizeof(T));
- else if (m_size)
+ else if (m_ptr && m_size)
memset(m_ptr, 0, m_size*sizeof(T));
}
|