forked from wolfSSL/wolfssl
Fixed bug when getting PEM encoded sz. Add idx check
This commit is contained in:
@ -15481,7 +15481,7 @@ int wolfSSL_get_chain_cert_pem(WOLFSSL_X509_CHAIN* chain, int idx,
|
|||||||
word32 szNeeded = 0;
|
word32 szNeeded = 0;
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_get_chain_cert_pem");
|
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;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
/* Null output buffer return size needed in outLen */
|
/* Null output buffer return size needed in outLen */
|
||||||
|
@ -225,7 +225,7 @@ static int CEscape(int escaped, byte e, byte* out, word32* i, word32 max,
|
|||||||
}
|
}
|
||||||
*i = idx;
|
*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;
|
return ASN_INPUT_E;
|
||||||
|
|
||||||
*outLen = i;
|
*outLen = i;
|
||||||
|
if(ret == 0)
|
||||||
|
return getSzOnly ? LENGTH_ONLY_E : 0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user