提交 f99dbfa4 编写于 作者: G Giel van Schijndel 提交者: Steve French

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: NGiel van Schijndel <me@mortis.eu>
Acked-by: NHerbert 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: NSteve French <steve.french@primarydata.com>
上级 ec6f34e5
...@@ -221,7 +221,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16, ...@@ -221,7 +221,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16,
} }
rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16)); rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16));
memset(wpwd, 0, 129 * sizeof(__le16)); memzero_explicit(wpwd, sizeof(wpwd));
return rc; return rc;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册