Skip to content

Commit

Permalink
Prevent crash for HTTP/0.9 requests (fix nginxinc#22).
Browse files Browse the repository at this point in the history
  • Loading branch information
p-pautov committed Dec 8, 2023
1 parent fc7e69a commit 958a4b6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/http_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,13 @@ ngx_int_t setHeader(ngx_http_request_t* r, StrView name, StrView value)
return NGX_OK;
}

header = (ngx_table_elt_t*)ngx_list_push(&r->headers_in.headers);
auto headers = &r->headers_in.headers;
if (!headers->pool && ngx_list_init(headers, r->pool, 2,
sizeof(ngx_table_elt_t)) != NGX_OK) {
return NGX_ERROR;
}

header = (ngx_table_elt_t*)ngx_list_push(headers);
if (header == NULL) {
return NGX_ERROR;
}
Expand Down

0 comments on commit 958a4b6

Please sign in to comment.