forked from wolfSSL/wolfssl
Fix overflow in fp_to_unsigned_bin_len length check. (#6075)
* Fix overflow in fp_to_unsigned_bin_len length check. * Add a second check when i == a->used - 1.
This commit is contained in:
@ -3834,7 +3834,10 @@ int fp_to_unsigned_bin_len(fp_int *a, unsigned char *b, int c)
|
|||||||
for (; x >= 0; x--) {
|
for (; x >= 0; x--) {
|
||||||
b[x] = 0;
|
b[x] = 0;
|
||||||
}
|
}
|
||||||
if ((i < a->used - 1) || ((a->dp[i] >> j) != 0)) {
|
if (i < a->used - 1) {
|
||||||
|
return FP_VAL;
|
||||||
|
}
|
||||||
|
if ((i == a->used - 1) && ((a->dp[i] >> j) != 0)) {
|
||||||
return FP_VAL;
|
return FP_VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user