diff --git a/src/ssl.c b/src/ssl.c index 3addd1ed1..a1deb34fc 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -1301,13 +1301,18 @@ static const WOLFSSL_SRTP_PROTECTION_PROFILE gSrtpProfiles[] = { static const WOLFSSL_SRTP_PROTECTION_PROFILE* DtlsSrtpFindProfile( const char* profile_str, word32 profile_str_len, unsigned long id) { + size_t srtp_profile_len; int i; const WOLFSSL_SRTP_PROTECTION_PROFILE* profile = NULL; for (i=0; i<(int)(sizeof(gSrtpProfiles)/sizeof(WOLFSSL_SRTP_PROTECTION_PROFILE)); i++) { if (profile_str != NULL) { - if (XMEMCMP(gSrtpProfiles[i].name, profile_str, profile_str_len) + srtp_profile_len = strlen(gSrtpProfiles[i].name); + if (srtp_profile_len != profile_str_len) + continue; + + if (XMEMCMP(gSrtpProfiles[i].name, profile_str, profile_str_len) == 0) { profile = &gSrtpProfiles[i]; break;