From d16cf0416784db82147ee5aaad1054840d028e7d Mon Sep 17 00:00:00 2001 From: Zhidao HONG Date: Mon, 2 Aug 2021 12:30:38 +0800 Subject: 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. --- src/nxt_upstream.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nxt_upstream.c') diff --git a/src/nxt_upstream.c b/src/nxt_upstream.c index 9f81b286..de9b1d49 100644 --- a/src/nxt_upstream.c +++ b/src/nxt_upstream.c @@ -78,6 +78,10 @@ nxt_upstream_find(nxt_upstreams_t *upstreams, nxt_str_t *name, uint32_t i, n; nxt_upstream_t *upstream; + if (upstreams == NULL) { + return NXT_DECLINED; + } + upstream = &upstreams->upstream[0]; n = upstreams->items; -- cgit