From 1cc6ea4d0e9d9e96149aba835993d703bb2bae76 Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Thu, 28 Dec 2023 15:21:37 -0800 Subject: [PATCH] gate PrivBeginPrefix/PrivSuffix; init typeSz in ssh.c --- src/ssh.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ssh.c b/src/ssh.c index 4e3758d72..fcee2726b 100644 --- a/src/ssh.c +++ b/src/ssh.c @@ -1488,10 +1488,13 @@ union wolfSSH_key { static const char* PrivBeginOpenSSH = "-----BEGIN OPENSSH PRIVATE KEY-----"; static const char* PrivEndOpenSSH = "-----END OPENSSH PRIVATE KEY-----"; -static const char* PrivBeginPrefix = "-----BEGIN "; -/* static const char* PrivEndPrefix = "-----END "; */ -static const char* PrivSuffix = " PRIVATE KEY-----"; +#if !defined(NO_FILESYSTEM) && !defined(WOLFSSH_USER_FILESYSTEM) + /* currently only used in wolfSSH_ReadKey_file() */ + static const char* PrivBeginPrefix = "-----BEGIN "; + /* static const char* PrivEndPrefix = "-----END "; */ + static const char* PrivSuffix = " PRIVATE KEY-----"; +#endif static int DoSshPubKey(const byte* in, word32 inSz, byte** out, word32* outSz, const byte** outType, word32* outTypeSz, @@ -1503,7 +1506,7 @@ static int DoSshPubKey(const byte* in, word32 inSz, byte** out, char* type = NULL; char* key = NULL; int ret = WS_SUCCESS; - word32 newKeySz, typeSz; + word32 newKeySz, typeSz = 0; WOLFSSH_UNUSED(inSz); WOLFSSH_UNUSED(heap);