From 814141d31be33d0e3a30542bd41ff30d19e8ce0e Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 3 Jun 2016 22:25:02 +0100 Subject: [PATCH] math/mp-arith.c (mp_testbit): Want nonstrict comparison for bounds check. --- math/mp-arith.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- 2.11.0