Fix for possible leak in error case for wc_RsaKeyToDer.

This commit is contained in:
David Garske
2018-01-22 16:17:08 -08:00
parent 79f4b963cd
commit 4e10173eed

View File

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