From 545ba58cc0f0ff330d92bf52133e9c3ad364a75e Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Thu, 28 Jul 2022 09:27:49 -0500 Subject: [PATCH] sp_int.c sp_div(): add missing (err == MP_OKAY) clause to fix null ptr deref. --- wolfcrypt/src/sp_int.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfcrypt/src/sp_int.c b/wolfcrypt/src/sp_int.c index 763ec1f8f..ad74b1dc2 100644 --- a/wolfcrypt/src/sp_int.c +++ b/wolfcrypt/src/sp_int.c @@ -7121,7 +7121,7 @@ int sp_div(sp_int* a, sp_int* d, sp_int* r, sp_int* rem) } } - if (!done) { + if ((!done) && (err == MP_OKAY)) { #if (defined(WOLFSSL_SMALL_STACK) || defined(SP_ALLOC)) && \ !defined(WOLFSSL_SP_NO_MALLOC) int cnt = 4;