From 806135f1c93c09bb513efc1341d084951b080278 Mon Sep 17 00:00:00 2001 From: hongzhidao Date: Fri, 28 Aug 2020 00:53:36 -0400 Subject: Router: fixed "pass" to upstreams. Messed up return values in nxt_upstream_find() caused error in applying any configuration with a valid "pass" value in router configuration pointing to upstream. That wasn't the case in "listeners" objects, where the return value wasn't checked. Also, it caused segfault in cases where the "pass" option was configured with variables and resulting value was pointing to a non-existent upstream. Added missing return checks as well to catch possible memory allocation errors. The bug was introduced in d32bc428f46b. This closes #472 issue on GitHub. --- src/nxt_router.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nxt_router.c') diff --git a/src/nxt_router.c b/src/nxt_router.c index ea14c6fb..b7408c3c 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -1725,6 +1725,10 @@ nxt_router_conf_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf, tmcf->router_conf, &lscf.application); } + + if (nxt_slow_path(skcf->action == NULL)) { + goto fail; + } } } -- cgit