[PATCH] crypto: hash - initializing memory buffer for keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"ctx" is uninitialized. To avoid undefined behaviors or memory
disclosures, we better initialize it.

Signed-off-by: Kangjie Lu <kjlu@xxxxxxx>
---
 crypto/algif_hash.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index 178f4cd75ef1..129a124e5056 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -433,6 +433,7 @@ static int hash_accept_parent_nokey(void *private, struct sock *sk)
 	ctx = sock_kmalloc(sk, len, GFP_KERNEL);
 	if (!ctx)
 		return -ENOMEM;
+	memset(ctx, 0, len);
 
 	ctx->result = NULL;
 	ctx->len = len;
-- 
2.17.1




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux