hcrypto: fix off-by-one set-bit counting

This commit is contained in:
Nicolas Williams
2019-07-05 13:02:24 -05:00
parent 51aed5d820
commit 8bc5d5af10
2 changed files with 2 additions and 2 deletions

View File

@@ -305,7 +305,7 @@ DH_check_pubkey(const DH *dh, const BIGNUM *pub_key, int *codes)
unsigned i, n = BN_num_bits(pub_key);
unsigned bits = 0;
for (i = 0; i <= n; i++)
for (i = 0; i < n; i++)
if (BN_is_bit_set(pub_key, i))
bits++;