diff --git a/src/ssl.c b/src/ssl.c index c215101175..89cd4543f7 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -1295,10 +1295,12 @@ const char* wolfSSL_get_shared_ciphers(WOLFSSL* ssl, char* buf, int len) { const char* cipher; - if (ssl == NULL || len <= 0) + if (ssl == NULL || buf == NULL || len <= 0) return NULL; cipher = wolfSSL_get_cipher_name_iana(ssl); + if (cipher == NULL) + return NULL; len = (int)min((word32)len, (word32)(XSTRLEN(cipher) + 1)); XMEMCPY(buf, cipher, (size_t)len); return buf; @@ -3321,8 +3323,8 @@ int wolfSSL_CTX_set1_groups(WOLFSSL_CTX* ctx, int* groups, int i; int _groups[WOLFSSL_MAX_GROUP_COUNT]; WOLFSSL_ENTER("wolfSSL_CTX_set1_groups"); - if (count <= 0) { - WOLFSSL_MSG("Group count is not positive"); + if (groups == NULL || count <= 0) { + WOLFSSL_MSG("Groups NULL or count not positive"); return WOLFSSL_FAILURE; } if (count > WOLFSSL_MAX_GROUP_COUNT) { @@ -3360,8 +3362,8 @@ int wolfSSL_set1_groups(WOLFSSL* ssl, int* groups, int count) int i; int _groups[WOLFSSL_MAX_GROUP_COUNT]; WOLFSSL_ENTER("wolfSSL_CTX_set1_groups"); - if (count <= 0) { - WOLFSSL_MSG("Group count is not positive"); + if (groups == NULL || count <= 0) { + WOLFSSL_MSG("Groups NULL or count not positive"); return WOLFSSL_FAILURE; } if (count > WOLFSSL_MAX_GROUP_COUNT) {