summaryrefslogtreecommitdiff
path: root/secblock.h
diff options
context:
space:
mode:
Diffstat (limited to 'secblock.h')
-rw-r--r--secblock.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/secblock.h b/secblock.h
index 6f3aa63..760633e 100644
--- a/secblock.h
+++ b/secblock.h
@@ -9,8 +9,6 @@
#if defined(CRYPTOPP_MEMALIGN_AVAILABLE) || defined(CRYPTOPP_MM_MALLOC_AVAILABLE) || defined(QNX)
#include <malloc.h>
-#else
- #include <stdlib.h>
#endif
NAMESPACE_BEGIN(CryptoPP)
@@ -352,8 +350,11 @@ public:
//! copy contents and size from another SecBlock
void Assign(const SecBlock<T, A> &t)
{
- New(t.m_size);
- memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, m_size*sizeof(T));
+ if (this != &t)
+ {
+ New(t.m_size);
+ memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, m_size*sizeof(T));
+ }
}
SecBlock<T, A>& operator=(const SecBlock<T, A> &t)