summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2025-03-16 22:15:04 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2025-03-21 17:39:06 +0800
commitfdd305803bc1eb59c300503fb37911330692ef69 (patch)
treeac52df0afcf12d60c7b1326c7d81c78fb39ae146 /crypto
parent27b13425349e94ad77b174b032674097cab241c8 (diff)
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 <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/essiv.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/crypto/essiv.c b/crypto/essiv.c
index 1c00c3324058..ec0ec8992c2d 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;
}