Router: fixed segmentation fault.

In the case that routes or upstreams is empty and the pass option is a variable.
If the resolved pass is routes or upstreams, a segment error occurred.
This commit is contained in:
Zhidao HONG
2021-08-02 12:30:38 +08:00
parent db03dfad67
commit d16cf04167
3 changed files with 27 additions and 0 deletions

View File

@@ -1567,6 +1567,10 @@ nxt_http_route_find(nxt_http_routes_t *routes, nxt_str_t *name,
{
nxt_http_route_t **route, **end;
if (routes == NULL) {
return NXT_DECLINED;
}
route = &routes->route[0];
end = route + routes->items;