mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2025-02-07 13:38:28 +00:00
Clean GCC 10 Analyzer warnings
This commit is contained in:
parent
7a8e241c7c
commit
680956e134
2
hmac.cpp
2
hmac.cpp
@ -25,7 +25,7 @@ void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
|
||||
if (keylength <= blockSize)
|
||||
{
|
||||
// hmac.cpp:26:9: runtime error: null pointer passed as argument 2
|
||||
if (userKey && keylength)
|
||||
if (AccessIpad() && userKey && keylength)
|
||||
memcpy(AccessIpad(), userKey, keylength);
|
||||
}
|
||||
else
|
||||
|
3
misc.h
3
misc.h
@ -524,7 +524,8 @@ inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t cou
|
||||
# pragma warning(disable: 6386)
|
||||
# endif
|
||||
#endif
|
||||
memcpy(dest, src, count);
|
||||
if (src && dest)
|
||||
memcpy(dest, src, count);
|
||||
#if CRYPTOPP_MSC_VERSION
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user