Fixed bug when getting PEM encoded sz. Add idx check

This commit is contained in:
Nickolas Lapp
2015-07-27 10:43:49 -06:00
parent e363848ecc
commit b85637e06b
2 changed files with 4 additions and 2 deletions

View File

@ -15481,7 +15481,7 @@ int wolfSSL_get_chain_cert_pem(WOLFSSL_X509_CHAIN* chain, int idx,
word32 szNeeded = 0;
WOLFSSL_ENTER("wolfSSL_get_chain_cert_pem");
if (!chain || !outLen)
if (!chain || !outLen || idx < 0 || idx >= wolfSSL_get_chain_count(chain))
return BAD_FUNC_ARG;
/* Null output buffer return size needed in outLen */

View File

@ -225,7 +225,7 @@ static int CEscape(int escaped, byte e, byte* out, word32* i, word32 max,
}
*i = idx;
return getSzOnly ? LENGTH_ONLY_E : 0;
return 0;
}
@ -319,6 +319,8 @@ static int DoBase64_Encode(const byte* in, word32 inLen, byte* out,
return ASN_INPUT_E;
*outLen = i;
if(ret == 0)
return getSzOnly ? LENGTH_ONLY_E : 0;
return ret;
}