diff -up mutt-1.5.21/mutt_ssl_gnutls.c.debug mutt-1.5.21/mutt_ssl_gnutls.c --- mutt-1.5.21/mutt_ssl_gnutls.c.debug 2011-11-03 15:56:29.992235238 +0100 +++ mutt-1.5.21/mutt_ssl_gnutls.c 2011-11-03 16:23:42.960123578 +0100 @@ -434,9 +434,16 @@ static int tls_compare_certificates (con return 0; } - ptr = (unsigned char *)strstr((char*)b64_data.data, CERT_SEP) + 1; - ptr = (unsigned char *)strstr((char*)ptr, CERT_SEP); + ptr = (unsigned char *)memmem((char*)b64_data.data, b64_data.size, CERT_SEP, sizeof(CERT_SEP)); + if (ptr == NULL) + { + gnutls_free(cert.data); + FREE (&b64_data_data); + return 0; + } + ptr += 1; + ptr = (unsigned char *)memmem((char*)ptr, b64_data.size - (ptr - b64_data.data), CERT_SEP, sizeof(CERT_SEP)); b64_data.size = b64_data.size - (ptr - b64_data.data); b64_data.data = ptr;