commit 2015296f5d228f7b9264dbf57b827fec33aca14a
parent 507ce6782cdb711b4c41d36c884b8d2ca48cb29a
Author: Olaf Hering <olaf@aepfle.de>
Date: Fri, 12 Apr 2024 16:42:32 +0200
Fix bug 4787 "Use correct function for memory transfer in crypt_cfb_buf"
There are really just 8 bytes of memory to transfer from one place to
another. No C strings involved.
warning: 'strncpy' output truncated before terminating nul copying 8
bytes from a string of the same length [-Wstringop-truncation]
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/common/passcrypt.c b/src/common/passcrypt.c
@@ -61,7 +61,7 @@ crypt_cfb_buf(const char key[8], unsigned char *buf, unsigned len,
{
char des_key[8];
- strncpy(des_key, PASSCRYPT_KEY, 8);
+ memcpy(des_key, PASSCRYPT_KEY, 8);
des_setparity(des_key);
if (decrypt)
ecb_crypt(des_key, buf, len, DES_DECRYPT);