Skip to content

Commit

Permalink
Fixed segfault in ngx_http_find_virtual_server() within xquic module
Browse files Browse the repository at this point in the history
A segfault was corrected when calling ngx_http_find_virtual_server in the xquic module. The issue originated from c->data being taken as ngx_http_connection_t while regular expressions were in use. However, for http3 connections, c->data is a pointer to ngx_http_xquic_connection_t
  • Loading branch information
morf committed Jul 10, 2023
1 parent c02538c commit 10defc6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/ngx_http_xquic_module/ngx_http_xquic.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,18 @@ ngx_http_v3_cert_cb(const char *sni, void **chain,
hc = qc->http_connection;
c = qc->connection;

/* The ngx_http_find_virtual_server() function requires ngx_http_connection_t in c->data */
c->data = hc;

/*
* get the server core conf by sni, this is useful when multiple server
* block listen on the same port. but useless when there is noly a single
* server block
*/
ret = ngx_http_find_virtual_server_inner(c,
ret = ngx_http_find_virtual_server_inner(c, hc,
hc->addr_conf->virtual_names, &host, NULL, &cscf);
c->data = qc;

if (ret == NGX_OK) {
hc->ssl_servername = ngx_palloc(c->pool, sizeof(ngx_str_t));
if (hc->ssl_servername == NULL) {
Expand Down

0 comments on commit 10defc6

Please sign in to comment.