diff options
author | Giel van Schijndel <me@mortis.eu> | 2015-01-06 22:37:00 +0100 |
---|---|---|
committer | Steve French <steve.french@primarydata.com> | 2015-01-19 15:32:13 -0600 |
commit | f99dbfa4b39f90c3ba95169000cc2cdd59413f4e (patch) | |
tree | 3473d944a6d76de1877503636567d84051bd6228 /fs/cifs | |
parent | ec6f34e5b552fb0a52e6aae1a5afbbb1605cc6cc (diff) | |
download | lwn-f99dbfa4b39f90c3ba95169000cc2cdd59413f4e.tar.gz lwn-f99dbfa4b39f90c3ba95169000cc2cdd59413f4e.zip |
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')
-rw-r--r-- | fs/cifs/smbencrypt.c | 2 |
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; } |