summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_route.c
diff options
context:
space:
mode:
authorZhidao HONG <z.hong@f5.com>2021-08-02 12:30:38 +0800
committerZhidao HONG <z.hong@f5.com>2021-08-02 12:30:38 +0800
commitd16cf0416784db82147ee5aaad1054840d028e7d (patch)
tree1f4e96cbd7aa4c3623629d4fce9f5aa3eb57d507 /src/nxt_http_route.c
parentdb03dfad6745a7d87d784ac51ed2d52e1c50a557 (diff)
downloadunit-d16cf0416784db82147ee5aaad1054840d028e7d.tar.gz
unit-d16cf0416784db82147ee5aaad1054840d028e7d.tar.bz2
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.
Diffstat (limited to 'src/nxt_http_route.c')
-rw-r--r--src/nxt_http_route.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nxt_http_route.c b/src/nxt_http_route.c
index c38acdf3..065b3488 100644
--- a/src/nxt_http_route.c
+++ b/src/nxt_http_route.c
@@ -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;