From d21d95c629c3bd9c40a6348fd372650af1c3af91 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Fri, 31 Jul 2020 15:19:40 -0500 Subject: [PATCH] Fix OOB in fp_read_radix_16 --- wolfcrypt/src/tfm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wolfcrypt/src/tfm.c b/wolfcrypt/src/tfm.c index 16468ff9f..18a6dc790 100644 --- a/wolfcrypt/src/tfm.c +++ b/wolfcrypt/src/tfm.c @@ -4802,6 +4802,9 @@ static int fp_read_radix_16(fp_int *a, const char *str) else return FP_VAL; + if (k >= FP_SIZE) + return FP_VAL; + a->dp[k] |= ((fp_digit)ch) << j; j += 4; k += j == DIGIT_BIT;