forked from wolfSSL/wolfssl
Merge pull request #1334 from dgarske/fix_asn_leak
Fix for possible leak in error case for `wc_RsaKeyToDer`
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user