From d58add7e97ca4da72474762b439f1b0456ab067f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20Guimar=C3=A3es?= Date: Wed, 15 Jan 2014 10:56:49 -0300 Subject: [PATCH] added protection to test_CyaSSL_client_server fixed min macro --- src/tls.c | 4 ++-- tests/api.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tls.c b/src/tls.c index 5acc8e648..482271ba6 100644 --- a/src/tls.c +++ b/src/tls.c @@ -974,7 +974,7 @@ int TLSX_SNI_GetFromBuffer(const byte* clientHello, word32 helloSz, if (sniType != type) { offset += sniLen; - listLen -= MIN(ENUM_LEN + OPAQUE16_LEN + sniLen, listLen); + listLen -= min(ENUM_LEN + OPAQUE16_LEN + sniLen, listLen); continue; } @@ -985,7 +985,7 @@ int TLSX_SNI_GetFromBuffer(const byte* clientHello, word32 helloSz, } } - len16 -= MIN(2 * OPAQUE16_LEN + extLen, len16); + len16 -= min(2 * OPAQUE16_LEN + extLen, len16); } return len16 ? BUFFER_ERROR : SSL_SUCCESS; diff --git a/tests/api.c b/tests/api.c index e37d5e686..3dadad7a1 100644 --- a/tests/api.c +++ b/tests/api.c @@ -440,6 +440,8 @@ void test_CyaSSL_UseSNI(void) CyaSSL_free(ssl); CyaSSL_CTX_free(ctx); +#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) + /* Testing success case at ctx */ client_callbacks.ctx_ready = server_callbacks.ctx_ready = use_SNI_at_ctx; server_callbacks.on_result = verify_SNI_real_matching; @@ -473,6 +475,8 @@ void test_CyaSSL_UseSNI(void) test_CyaSSL_client_server(&client_callbacks, &server_callbacks); +#endif + test_CyaSSL_SNI_GetFromBuffer(); } #endif /* HAVE_SNI */