Fix #1510 - wrap X509_VERIFY_PARAM_set1_host() usage inside a conditional

This commit is contained in:
Sergey Lyubka 2022-04-05 13:09:17 +01:00
parent fde8b82b78
commit d11173fe90
2 changed files with 4 additions and 0 deletions

View File

@ -4540,6 +4540,7 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
#endif
}
}
#if OPENSSL_VERSION_NUMBER > 0x10002000L
if (opts->srvname.len > 0) {
char mem[128], *buf = mem;
size_t len = mg_asprintf(&buf, sizeof(mem), "%.*s", (int) opts->srvname.len,
@ -4547,6 +4548,7 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
X509_VERIFY_PARAM_set1_host(SSL_get0_param(tls->ssl), buf, len);
if (buf != mem) free(buf);
}
#endif
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
if (opts->srvname.len > 0) {
char mem[128], *buf = mem;

View File

@ -88,6 +88,7 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
#endif
}
}
#if OPENSSL_VERSION_NUMBER > 0x10002000L
if (opts->srvname.len > 0) {
char mem[128], *buf = mem;
size_t len = mg_asprintf(&buf, sizeof(mem), "%.*s", (int) opts->srvname.len,
@ -95,6 +96,7 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
X509_VERIFY_PARAM_set1_host(SSL_get0_param(tls->ssl), buf, len);
if (buf != mem) free(buf);
}
#endif
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
if (opts->srvname.len > 0) {
char mem[128], *buf = mem;