From 298ebd6024cee33ce6ce5f91a9c1596cdf405a62 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Fri, 5 Mar 2021 10:02:07 +1000 Subject: [PATCH] MP small: read radix set result to 0 on all errors --- wolfcrypt/src/integer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index a4fc5f6ca..b2eafb4cc 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -5229,9 +5229,11 @@ int mp_read_radix (mp_int * a, const char *str, int radix) */ if (y < radix) { if ((res = mp_mul_d (a, (mp_digit) radix, a)) != MP_OKAY) { + mp_zero(a); return res; } if ((res = mp_add_d (a, (mp_digit) y, a)) != MP_OKAY) { + mp_zero(a); return res; } } else {