adjust macro guard to avoid leak for build without cert support

pull/740/head
JacobBarthelmeh 2024-09-27 11:30:30 -06:00
parent df17913967
commit f0922715af
1 changed files with 8 additions and 6 deletions

View File

@ -2061,7 +2061,7 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx,
int format, int type) int format, int type)
{ {
void* heap = NULL; void* heap = NULL;
byte* der; byte* der = NULL;
word32 derSz; word32 derSz;
int wcType; int wcType;
int ret = WS_SUCCESS; int ret = WS_SUCCESS;
@ -2078,7 +2078,12 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx,
return WS_BAD_FILETYPE_E; 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; dynamicType = DYNTYPE_CA;
wcType = CA_TYPE; wcType = CA_TYPE;
} }
@ -2086,10 +2091,7 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx,
dynamicType = DYNTYPE_CERT; dynamicType = DYNTYPE_CERT;
wcType = CERT_TYPE; wcType = CERT_TYPE;
} }
else if (type == BUFTYPE_PRIVKEY) { #endif
dynamicType = DYNTYPE_PRIVKEY;
wcType = PRIVATEKEY_TYPE;
}
else { else {
return WS_BAD_ARGUMENT; return WS_BAD_ARGUMENT;
} }