Merge pull request #2248 from kaleb-himes/ZD-5141

Fix for potential leak on err: Thanks to Chris H. for the report
This commit is contained in:
JacobBarthelmeh 2019-05-20 16:11:40 -06:00 committed by GitHub
commit c77b99a8a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4156,8 +4156,10 @@ int wc_DsaKeyToDer(DsaKey* key, byte* output, word32 inLen)
seqSz = SetSequence(verSz + intTotalLen, seq);
outLen = seqSz + verSz + intTotalLen;
if (outLen > (int)inLen)
if (outLen > (int)inLen) {
FreeTmpDsas(tmps, key->heap);
return BAD_FUNC_ARG;
}
/* write to output */
XMEMCPY(output, seq, seqSz);