Skip to content

Commit fdd3058

Browse files
tobluxherbertx
authored andcommitted
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>
1 parent 27b1342 commit fdd3058

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

crypto/essiv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,7 @@ static bool parse_cipher_name(char *essiv_cipher_name, const char *cra_name)
405405
if (len >= CRYPTO_MAX_ALG_NAME)
406406
return false;
407407

408-
memcpy(essiv_cipher_name, p, len);
409-
essiv_cipher_name[len] = '\0';
408+
strscpy(essiv_cipher_name, p, len + 1);
410409
return true;
411410
}
412411

0 commit comments

Comments
 (0)