From: Mark Wooding Date: Fri, 3 Jun 2016 21:25:02 +0000 (+0100) Subject: math/mp-arith.c (mp_testbit): Want nonstrict comparison for bounds check. X-Git-Tag: 2.2.2~1 X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/commitdiff_plain/814141d31be33d0e3a30542bd41ff30d19e8ce0e math/mp-arith.c (mp_testbit): Want nonstrict comparison for bounds check. --- diff --git a/math/mp-arith.c b/math/mp-arith.c index 2d7d6359..61780b0f 100644 --- a/math/mp-arith.c +++ b/math/mp-arith.c @@ -116,7 +116,7 @@ mp *mp_lsr2c(mp *d, mp *a, size_t n) int mp_testbit(mp *x, unsigned long n) { - if (n > MPW_BITS * MP_LEN(x)) + if (n >= MPW_BITS * MP_LEN(x)) return (0); return ((x->v[n/MPW_BITS] >> n%MPW_BITS) & 1u); }