forked from wolfSSL/wolfssl
Merge pull request #8710 from JacobBarthelmeh/codesonar
ech get length fix and x509 extension print temporary buffer size
This commit is contained in:
15
src/ssl.c
15
src/ssl.c
@ -1004,16 +1004,23 @@ int GetEchConfigsEx(WOLFSSL_EchConfig* configs, byte* output, word32* outputLen)
|
|||||||
WOLFSSL_EchConfig* workingConfig = NULL;
|
WOLFSSL_EchConfig* workingConfig = NULL;
|
||||||
byte* outputStart = output;
|
byte* outputStart = output;
|
||||||
word32 totalLen = 2;
|
word32 totalLen = 2;
|
||||||
word32 workingOutputLen;
|
word32 workingOutputLen = 0;
|
||||||
|
|
||||||
if (configs == NULL || outputLen == NULL || *outputLen < totalLen)
|
if (configs == NULL || outputLen == NULL ||
|
||||||
|
(output != NULL && *outputLen < totalLen)) {
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
workingOutputLen = *outputLen - totalLen;
|
|
||||||
|
|
||||||
/* skip over total length which we fill in later */
|
/* skip over total length which we fill in later */
|
||||||
if (output != NULL)
|
if (output != NULL) {
|
||||||
|
workingOutputLen = *outputLen - totalLen;
|
||||||
output += 2;
|
output += 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* caller getting the size only, set current 2 byte length size */
|
||||||
|
*outputLen = totalLen;
|
||||||
|
}
|
||||||
|
|
||||||
workingConfig = configs;
|
workingConfig = configs;
|
||||||
|
|
||||||
|
@ -6554,8 +6554,7 @@ static int X509PrintExtensions(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
|
|||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = (char*)XMALLOC(MAX_WIDTH-4-indent, x509->heap,
|
buf = (char*)XMALLOC(MAX_WIDTH, x509->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
DYNAMIC_TYPE_TMP_BUFFER);
|
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user