From 0edc19feb20551257ee7ff29af9c25610efdae46 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 9 Apr 2013 19:03:21 -0700 Subject: [PATCH] converting DerToPem, readjust output buffer size to account for size of header and footer when calling Base64_Encode --- ctaocrypt/src/asn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctaocrypt/src/asn.c b/ctaocrypt/src/asn.c index 4986fb02b..200b99b3d 100644 --- a/ctaocrypt/src/asn.c +++ b/ctaocrypt/src/asn.c @@ -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;