Commit 1d03522625f46214733e8e143a4765c01fc146f9

Steffen Jaeckel 2017-08-29T16:53:31

make sure fast_s_mp_mul_digs() doesn't BOF This fixes #60 and #80

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/bn_fast_s_mp_mul_digs.c b/bn_fast_s_mp_mul_digs.c
index 558d151..875798e 100644
--- a/bn_fast_s_mp_mul_digs.c
+++ b/bn_fast_s_mp_mul_digs.c
@@ -87,7 +87,7 @@ int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
    {
       mp_digit *tmpc;
       tmpc = c->dp;
-      for (ix = 0; ix < (pa + 1); ix++) {
+      for (ix = 0; ix < pa; ix++) {
          /* now extract the previous digit [below the carry] */
          *tmpc++ = W[ix];
       }