use memmove for overlapping buffers

pull/186/head
Berendea Nicolae 2016-06-13 22:27:30 +03:00 committed by GitHub
parent aaed9ae803
commit caec8f98e2
1 changed files with 2 additions and 2 deletions

View File

@ -210,7 +210,7 @@ void CBC_CTS_Encryption::ProcessLastBlock(byte *outString, const byte *inString,
if (inString == outString)
{
length -= BlockSize();
memcpy(outString, inString+BlockSize(), length);
memmove(outString, inString+BlockSize(), length);
memcpy(outString+BlockSize(), m_register, length);
}
else
@ -278,7 +278,7 @@ void CBC_CTS_Decryption::ProcessLastBlock(byte *outString, const byte *inString,
{
if (inString == outString)
{
memcpy(outString, inString+BlockSize(), length);
memmove(outString, inString+BlockSize(), length);
memcpy(outString+BlockSize(), m_temp, length);
// decrypt next to last plaintext block
memcpy(m_temp, pn1, length);