diff --git a/wolfcrypt/src/pwdbased.c b/wolfcrypt/src/pwdbased.c index cf82b1597..541ebca67 100644 --- a/wolfcrypt/src/pwdbased.c +++ b/wolfcrypt/src/pwdbased.c @@ -501,6 +501,8 @@ int wc_PKCS12_PBKDF_ex(byte* output, const byte* passwd, int passLen, if (ret < 0) break; } + if (ret < 0) break; + currentLen = min(kLen, (int)u); XMEMCPY(output, Ai, currentLen); output += currentLen;