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>
This commit is contained in:
parent
ec6f34e5b5
commit
f99dbfa4b3
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue