From f0922715af88cde20ff0e130e938faa1032dfdc5 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Fri, 27 Sep 2024 11:30:30 -0600 Subject: [PATCH] adjust macro guard to avoid leak for build without cert support --- src/internal.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/internal.c b/src/internal.c index 3fce24289..222682a33 100644 --- a/src/internal.c +++ b/src/internal.c @@ -2061,7 +2061,7 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx, int format, int type) { void* heap = NULL; - byte* der; + byte* der = NULL; word32 derSz; int wcType; int ret = WS_SUCCESS; @@ -2078,7 +2078,12 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx, return WS_BAD_FILETYPE_E; } - if (type == BUFTYPE_CA) { + if (type == BUFTYPE_PRIVKEY) { + dynamicType = DYNTYPE_PRIVKEY; + wcType = PRIVATEKEY_TYPE; + } + #ifdef WOLFSSH_CERTS + else if (type == BUFTYPE_CA) { dynamicType = DYNTYPE_CA; wcType = CA_TYPE; } @@ -2086,10 +2091,7 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx, dynamicType = DYNTYPE_CERT; wcType = CERT_TYPE; } - else if (type == BUFTYPE_PRIVKEY) { - dynamicType = DYNTYPE_PRIVKEY; - wcType = PRIVATEKEY_TYPE; - } + #endif else { return WS_BAD_ARGUMENT; }