From f2aa190f60cc3b6e8b4eb09b044eaea1f4087a0a Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 30 May 2019 15:33:51 +0300 Subject: Fixed segfault with empty rule array. --- src/nxt_http_route.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nxt_http_route.c') diff --git a/src/nxt_http_route.c b/src/nxt_http_route.c index 526f9472..2a41d7fa 100644 --- a/src/nxt_http_route.c +++ b/src/nxt_http_route.c @@ -819,10 +819,11 @@ nxt_http_route_rule(nxt_http_request_t *r, nxt_http_route_rule_t *rule) } } + ret = 1; pattern = &rule->pattern[0]; end = pattern + rule->items; - do { + while (pattern < end) { ret = nxt_http_route_pattern(r, pattern, start, length); ret ^= pattern->negative; @@ -832,8 +833,7 @@ nxt_http_route_rule(nxt_http_request_t *r, nxt_http_route_rule_t *rule) } pattern++; - - } while (pattern < end); + } return ret; } -- cgit