[PATCH] crypto: aead.c: Cleaning up missing null-terminate in conjunction with strncpy

From: Rickard Strandqvist
Date: Sat Jul 26 2014 - 10:09:28 EST


Replacing strncpy with strlcpy to avoid strings that lacks null terminate.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
---
crypto/aead.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/crypto/aead.c b/crypto/aead.c
index 547491e..249ab07 100644
--- a/crypto/aead.c
+++ b/crypto/aead.c
@@ -117,8 +117,8 @@ static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg)
struct crypto_report_aead raead;
struct aead_alg *aead = &alg->cra_aead;

- strncpy(raead.type, "aead", sizeof(raead.type));
- strncpy(raead.geniv, aead->geniv ?: "<built-in>", sizeof(raead.geniv));
+ strlcpy(raead.type, "aead", sizeof(raead.type));
+ strlcpy(raead.geniv, aead->geniv ?: "<built-in>", sizeof(raead.geniv));

raead.blocksize = alg->cra_blocksize;
raead.maxauthsize = aead->maxauthsize;
@@ -202,8 +202,8 @@ static int crypto_nivaead_report(struct sk_buff *skb, struct crypto_alg *alg)
struct crypto_report_aead raead;
struct aead_alg *aead = &alg->cra_aead;

- strncpy(raead.type, "nivaead", sizeof(raead.type));
- strncpy(raead.geniv, aead->geniv, sizeof(raead.geniv));
+ strlcpy(raead.type, "nivaead", sizeof(raead.type));
+ strlcpy(raead.geniv, aead->geniv, sizeof(raead.geniv));

raead.blocksize = alg->cra_blocksize;
raead.maxauthsize = aead->maxauthsize;
--
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/