mirror of
https://github.com/QuasarApp/openssl.git
synced 2025-05-21 13:59:40 +00:00
Avoid creating an illegal pointer
Found by tis-interpreter Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #1106
This commit is contained in:
parent
169a8e391e
commit
acc600928d
@ -278,6 +278,9 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
|
|||||||
res->top--;
|
res->top--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Increase the resp pointer so that we never create an invalid pointer. */
|
||||||
|
resp++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if res->top == 0 then clear the neg value otherwise decrease the resp
|
* if res->top == 0 then clear the neg value otherwise decrease the resp
|
||||||
* pointer
|
* pointer
|
||||||
@ -287,7 +290,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
|
|||||||
else
|
else
|
||||||
resp--;
|
resp--;
|
||||||
|
|
||||||
for (i = 0; i < loop - 1; i++, wnump--, resp--) {
|
for (i = 0; i < loop - 1; i++, wnump--) {
|
||||||
BN_ULONG q, l0;
|
BN_ULONG q, l0;
|
||||||
/*
|
/*
|
||||||
* the first part of the loop uses the top two words of snum and sdiv
|
* the first part of the loop uses the top two words of snum and sdiv
|
||||||
@ -393,6 +396,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
|
|||||||
(*wnump)++;
|
(*wnump)++;
|
||||||
}
|
}
|
||||||
/* store part of the result */
|
/* store part of the result */
|
||||||
|
resp--;
|
||||||
*resp = q;
|
*resp = q;
|
||||||
}
|
}
|
||||||
bn_correct_top(snum);
|
bn_correct_top(snum);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user