From 60cf1399611ae1b2728492c94ff57a4a044774b4 Mon Sep 17 00:00:00 2001 From: Oisin Canty Date: Thu, 5 Aug 2021 16:00:01 +0000 Subject: Router: fixed crash when matching an empty address pattern array. A crash would occur when the router tried to match an against an empty address pattern array. The following configuration was used to reproduce the issue: { "listeners": { "127.0.0.1:8082": { "pass": "routes" } }, "routes": [ { "match": { "source": [] }, "action": { "return": 200 } } ] } --- src/nxt_http_route.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/nxt_http_route.c b/src/nxt_http_route.c index 065b3488..b330796f 100644 --- a/src/nxt_http_route.c +++ b/src/nxt_http_route.c @@ -1936,6 +1936,11 @@ nxt_http_route_addr_rule(nxt_http_request_t *r, nxt_http_route_addr_pattern_t *p; n = addr_rule->items; + + if (n == 0) { + return 0; + } + p = &addr_rule->addr_pattern[0] - 1; do { -- cgit