summaryrefslogtreecommitdiff
path: root/fs/cifs/smbencrypt.c
diff options
context:
space:
mode:
authorGiel van Schijndel <me@mortis.eu>2015-01-06 22:37:00 +0100
committerSteve French <steve.french@primarydata.com>2015-01-19 15:32:13 -0600
commitf99dbfa4b39f90c3ba95169000cc2cdd59413f4e (patch)
tree3473d944a6d76de1877503636567d84051bd6228 /fs/cifs/smbencrypt.c
parentec6f34e5b552fb0a52e6aae1a5afbbb1605cc6cc (diff)
cifs: use memzero_explicit to clear stack buffer
When leaving a function use memzero_explicit instead of memset(0) to clear stack allocated buffers. memset(0) may be optimized away. This particular buffer is highly likely to contain sensitive data which we shouldn't leak (it's named 'passwd' after all). Signed-off-by: Giel van Schijndel <me@mortis.eu> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Reported-at: http://www.viva64.com/en/b/0299/ Reported-by: Andrey Karpov Reported-by: Svyatoslav Razmyslov Signed-off-by: Steve French <steve.french@primarydata.com>
Diffstat (limited to 'fs/cifs/smbencrypt.c')
-rw-r--r--fs/cifs/smbencrypt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c
index 6c1566366a66..a4232ec4f2ba 100644
--- a/fs/cifs/smbencrypt.c
+++ b/fs/cifs/smbencrypt.c
@@ -221,7 +221,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16,
}
rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16));
- memset(wpwd, 0, 129 * sizeof(__le16));
+ memzero_explicit(wpwd, sizeof(wpwd));
return rc;
}