converting DerToPem, readjust output buffer size to account for size of header and footer when calling Base64_Encode

This commit is contained in:
John Safranek 2013-04-09 19:03:21 -07:00
parent e98193000a
commit 0edc19feb2

View File

@ -2790,7 +2790,7 @@ int DerToPem(const byte* der, word32 derSz, byte* output, word32 outSz,
i = headerLen;
/* body */
outLen = outSz; /* input to Base64_Encode */
outLen = outSz - (headerLen + footerLen); /* input to Base64_Encode */
if ( (err = Base64_Encode(der, derSz, output + i, (word32*)&outLen)) < 0)
return err;
i += outLen;