From: Thorsten Blum Date: Sun, 16 Mar 2025 21:15:04 +0000 (+0100) Subject: crypto: essiv - Replace memcpy() + NUL-termination with strscpy() X-Git-Tag: v6.15-rc1~118^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fdd305803bc1eb59c300503fb37911330692ef69;p=thirdparty%2Fkernel%2Flinux.git crypto: essiv - Replace memcpy() + NUL-termination with strscpy() Use strscpy() to copy the NUL-terminated string 'p' to the destination buffer instead of using memcpy() followed by a manual NUL-termination. No functional changes intended. Signed-off-by: Thorsten Blum Signed-off-by: Herbert Xu --- diff --git a/crypto/essiv.c b/crypto/essiv.c index 1c00c3324058c..ec0ec8992c2da 100644 --- a/crypto/essiv.c +++ b/crypto/essiv.c @@ -405,8 +405,7 @@ static bool parse_cipher_name(char *essiv_cipher_name, const char *cra_name) if (len >= CRYPTO_MAX_ALG_NAME) return false; - memcpy(essiv_cipher_name, p, len); - essiv_cipher_name[len] = '\0'; + strscpy(essiv_cipher_name, p, len + 1); return true; }