From 3cd5a97473c072404509224fc8bb100d94fb5e0d Mon Sep 17 00:00:00 2001 From: John Safranek Date: Thu, 14 Nov 2019 14:42:58 -0800 Subject: [PATCH] Maintenance 1. When getting the DH public key, initialize the P, G, and Pub pointers to NULL, then set that we own the DH parameters flag. This allows FreeSSL to correctly clean up the DH key. --- src/internal.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/internal.c b/src/internal.c index ef64900dd..9af41689e 100644 --- a/src/internal.c +++ b/src/internal.c @@ -19575,6 +19575,12 @@ static int GetDhPublicKey(WOLFSSL* ssl, const byte* input, word32 size, int group = 0; #endif + ssl->buffers.weOwnDH = 1; + + ssl->buffers.serverDH_P.buffer = NULL; + ssl->buffers.serverDH_G.buffer = NULL; + ssl->buffers.serverDH_Pub.buffer = NULL; + /* p */ if ((args->idx - args->begin) + OPAQUE16_LEN > size) { ERROR_OUT(BUFFER_ERROR, exit_gdpk); @@ -19638,8 +19644,6 @@ static int GetDhPublicKey(WOLFSSL* ssl, const byte* input, word32 size, length); args->idx += length; - ssl->buffers.weOwnDH = 1; - /* pub */ if ((args->idx - args->begin) + OPAQUE16_LEN > size) { ERROR_OUT(BUFFER_ERROR, exit_gdpk);