From 0522e19fc1f2b399ef52a6a1268ccf4d6e91ef30 Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Sun, 10 Oct 2021 21:02:03 +0200 Subject: [PATCH] Check return value of mp_grow in mp_mod_2d ZD13048 --- wolfcrypt/src/integer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index 70a379f0b..a69573af9 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -690,7 +690,9 @@ int mp_mod_2d (mp_int * a, int b, mp_int * c) mp_digit carry = 0; /* grow result to size of modulus */ - mp_grow(c, bmax); + if ((res = mp_grow(c, bmax)) != MP_OKAY) { + return res; + } /* negate value */ for (x = 0; x < c->used; x++) { mp_digit next = c->dp[x] > 0;