Skip to content

Commit f092271

Browse files
adjust macro guard to avoid leak for build without cert support
1 parent df17913 commit f092271

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/internal.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,7 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx,
20612061
int format, int type)
20622062
{
20632063
void* heap = NULL;
2064-
byte* der;
2064+
byte* der = NULL;
20652065
word32 derSz;
20662066
int wcType;
20672067
int ret = WS_SUCCESS;
@@ -2078,18 +2078,20 @@ int wolfSSH_ProcessBuffer(WOLFSSH_CTX* ctx,
20782078
return WS_BAD_FILETYPE_E;
20792079
}
20802080

2081-
if (type == BUFTYPE_CA) {
2081+
if (type == BUFTYPE_PRIVKEY) {
2082+
dynamicType = DYNTYPE_PRIVKEY;
2083+
wcType = PRIVATEKEY_TYPE;
2084+
}
2085+
#ifdef WOLFSSH_CERTS
2086+
else if (type == BUFTYPE_CA) {
20822087
dynamicType = DYNTYPE_CA;
20832088
wcType = CA_TYPE;
20842089
}
20852090
else if (type == BUFTYPE_CERT) {
20862091
dynamicType = DYNTYPE_CERT;
20872092
wcType = CERT_TYPE;
20882093
}
2089-
else if (type == BUFTYPE_PRIVKEY) {
2090-
dynamicType = DYNTYPE_PRIVKEY;
2091-
wcType = PRIVATEKEY_TYPE;
2092-
}
2094+
#endif
20932095
else {
20942096
return WS_BAD_ARGUMENT;
20952097
}

0 commit comments

Comments
 (0)