]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
modes: fix coverity 1449860: overlapping memory copy
authorPauli <ppzgs1@gmail.com>
Wed, 17 Mar 2021 01:41:48 +0000 (11:41 +1000)
committerPauli <ppzgs1@gmail.com>
Thu, 18 Mar 2021 11:14:56 +0000 (21:14 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14584)

crypto/modes/cbc128.c

index 9ac9299f65880496cd77c4f377bb7802c3324f76..86dd781c551c417fc68d2680ea2d6be76e4bd934 100644 (file)
@@ -69,7 +69,8 @@ void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
         in += 16;
         out += 16;
     }
-    memcpy(ivec, iv, 16);
+    if (ivec != iv)
+        memcpy(ivec, iv, 16);
 }
 
 void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,