Merge pull request #1051 from kaleb-himes/fsanitize-fixes

Fsanitize fixes
This commit is contained in:
dgarske 2017-07-25 20:57:43 -07:00 committed by GitHub
commit 41e2b236aa
2 changed files with 18 additions and 4 deletions

View File

@ -4646,6 +4646,13 @@ void SSL_ResourceFree(WOLFSSL* ssl)
#ifdef HAVE_ED25519
FreeKey(ssl, DYNAMIC_TYPE_ED25519, (void**)&ssl->peerEd25519Key);
ssl->peerEd25519KeyPresent = 0;
#ifdef HAVE_PK_CALLBACKS
if (ssl->buffers.peerEd25519Key.buffer != NULL) {
XFREE(ssl->buffers.peerEd25519Key.buffer, ssl->heap,
DYNAMIC_TYPE_ED25519);
ssl->buffers.peerEd25519Key.buffer = NULL;
}
#endif
#endif
#ifdef HAVE_PK_CALLBACKS
#ifdef HAVE_ECC
@ -4838,6 +4845,11 @@ void FreeHandshakeResources(WOLFSSL* ssl)
XFREE(ssl->buffers.peerRsaKey.buffer, ssl->heap, DYNAMIC_TYPE_RSA);
ssl->buffers.peerRsaKey.buffer = NULL;
#endif /* NO_RSA */
#ifdef HAVE_ED25519
XFREE(ssl->buffers.peerEd25519Key.buffer, ssl->heap,
DYNAMIC_TYPE_ED25519);
ssl->buffers.peerEd25519Key.buffer = NULL;
#endif
#endif /* HAVE_PK_CALLBACKS */
#ifdef HAVE_QSH
@ -8489,10 +8501,10 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx,
int keyRet = 0;
if (ssl->peerEd25519Key == NULL) {
/* alloc/init on demand */
keyRet = AllocKey(ssl, DYNAMIC_TYPE_ECC,
keyRet = AllocKey(ssl, DYNAMIC_TYPE_ED25519,
(void**)&ssl->peerEd25519Key);
} else if (ssl->peerEd25519KeyPresent) {
keyRet = ReuseKey(ssl, DYNAMIC_TYPE_ECC,
keyRet = ReuseKey(ssl, DYNAMIC_TYPE_ED25519,
ssl->peerEd25519Key);
ssl->peerEd25519KeyPresent = 0;
}
@ -8509,7 +8521,7 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx,
#ifdef HAVE_PK_CALLBACKS
ssl->buffers.peerEd25519Key.buffer =
(byte*)XMALLOC(args->dCert->pubKeySize,
ssl->heap, DYNAMIC_TYPE_ECC);
ssl->heap, DYNAMIC_TYPE_ED25519);
if (ssl->buffers.peerEd25519Key.buffer == NULL) {
ERROR_OUT(MEMORY_ERROR, exit_ppc);
}

View File

@ -182,6 +182,9 @@ static int execute_test_case(int svr_argc, char** svr_argv,
int i;
size_t added;
static int tests = 1;
#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_TIRTOS)
char portNumber[8];
#endif
/* Is Valid Cipher and Version Checks */
/* build command list for the Is checks below */
@ -298,7 +301,6 @@ static int execute_test_case(int svr_argc, char** svr_argv,
if (cliArgs.argc + 2 > MAX_ARGS)
printf("cannot add the magic port number flag to client\n");
else {
char portNumber[8];
snprintf(portNumber, sizeof(portNumber), "%d", ready.port);
cli_argv[cliArgs.argc++] = portFlag;
cli_argv[cliArgs.argc++] = portNumber;