mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
crypto: hisilicon/hpre - fix pointer dereference before length check
In hpre_rsa_drop_leading_zeros(), the loop condition dereferences *ptr
before checking *len, causing an out-of-bounds read when *len is zero.
Swap to while (*len && !**ptr) to test length first.
Fixes: c8b4b47707 ("crypto: hisilicon - add HiSilicon HPRE accelerator")
Cc: stable@vger.kernel.org
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
4b8ae27320
commit
9770bb7d33
|
|
@ -720,7 +720,7 @@ static void hpre_dh_exit_tfm(struct crypto_kpp *tfm)
|
|||
|
||||
static void hpre_rsa_drop_leading_zeros(const char **ptr, size_t *len)
|
||||
{
|
||||
while (!**ptr && *len) {
|
||||
while (*len && !**ptr) {
|
||||
(*ptr)++;
|
||||
(*len)--;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user