added protection to test_CyaSSL_client_server

fixed min macro
This commit is contained in:
Moisés Guimarães
2014-01-15 10:56:49 -03:00
parent 9f7e33e7e1
commit d58add7e97
2 changed files with 6 additions and 2 deletions

View File

@@ -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;

View File

@@ -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 */