From 6dbca2b718afc7568c9a34f3927eec578dc817eb Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 20 Jun 2018 10:48:19 -0700 Subject: [PATCH] Fix to resolve the increased stack by allocating the temp `ssl` from the heap. --- src/ssl.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 3375eab41..58345be51 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -11330,15 +11330,20 @@ int wolfSSL_set_compression(WOLFSSL* ssl) long wolfSSL_CTX_set_options(WOLFSSL_CTX* ctx, long opt) { - WOLFSSL ssl; + WOLFSSL* ssl; WOLFSSL_ENTER("SSL_CTX_set_options"); - if (ctx == NULL) return BAD_FUNC_ARG; - XMEMSET(&ssl, 0, sizeof(ssl)); - ssl.options.mask = ctx->mask; - ctx->mask = wolfSSL_set_options(&ssl, opt); + ssl = (WOLFSSL*)XMALLOC(sizeof(WOLFSSL), ctx->heap, DYNAMIC_TYPE_SSL); + if (ssl == NULL) + return MEMORY_E; + + XMEMSET(ssl, 0, sizeof(WOLFSSL)); + ssl->options.mask = ctx->mask; + ctx->mask = wolfSSL_set_options(ssl, opt); + + XFREE(ssl, ctx->heap, DYNAMIC_TYPE_SSL); return ctx->mask; }