[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250316211504.39327-2-thorsten.blum@linux.dev>
Date: Sun, 16 Mar 2025 22:15:04 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] 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@...ux.dev>
---
crypto/essiv.c | 3 +--
1 file changed, 1 insertion(+), 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;
}
--
2.48.1
Powered by blists - more mailing lists