nghttpd: Fix crash
This commit is contained in:
parent
75a1ad8bdb
commit
8a0fdcfea9
|
@ -1420,9 +1420,9 @@ namespace {
|
||||||
int next_proto_cb(SSL *s, const unsigned char **data, unsigned int *len,
|
int next_proto_cb(SSL *s, const unsigned char **data, unsigned int *len,
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
auto next_proto = static_cast<std::pair<unsigned char*, size_t>* >(arg);
|
auto next_proto = static_cast<std::vector<unsigned char>*>(arg);
|
||||||
*data = next_proto->first;
|
*data = next_proto->data();
|
||||||
*len = next_proto->second;
|
*len = next_proto->size();
|
||||||
return SSL_TLSEXT_ERR_OK;
|
return SSL_TLSEXT_ERR_OK;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -1554,7 +1554,7 @@ int alpn_select_proto_cb(SSL* ssl,
|
||||||
int HttpServer::run()
|
int HttpServer::run()
|
||||||
{
|
{
|
||||||
SSL_CTX *ssl_ctx = nullptr;
|
SSL_CTX *ssl_ctx = nullptr;
|
||||||
std::pair<unsigned char*, size_t> next_proto;
|
std::vector<unsigned char> next_proto;
|
||||||
|
|
||||||
if(!config_->no_tls) {
|
if(!config_->no_tls) {
|
||||||
ssl_ctx = SSL_CTX_new(SSLv23_server_method());
|
ssl_ctx = SSL_CTX_new(SSLv23_server_method());
|
||||||
|
@ -1646,13 +1646,7 @@ int HttpServer::run()
|
||||||
verify_callback);
|
verify_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto proto_list = util::get_default_alpn();
|
next_proto = util::get_default_alpn();
|
||||||
|
|
||||||
std::pair<unsigned char*, size_t> next_proto(proto_list.data(),
|
|
||||||
proto_list.size());
|
|
||||||
|
|
||||||
next_proto.first = proto_list.data();
|
|
||||||
next_proto.second = proto_list.size();
|
|
||||||
|
|
||||||
SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, &next_proto);
|
SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, &next_proto);
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
|
|
Loading…
Reference in New Issue