Merge pull request #1334 from dgarske/fix_asn_leak

Fix for possible leak in error case for `wc_RsaKeyToDer`
This commit is contained in:
JacobBarthelmeh
2018-01-22 23:20:39 -07:00
committed by GitHub

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);