summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2019-05-30 15:33:51 +0300
committerIgor Sysoev <igor@sysoev.ru>2019-05-30 15:33:51 +0300
commitf2aa190f60cc3b6e8b4eb09b044eaea1f4087a0a (patch)
treeb3606d17fc2aa8641c05a11c5e082912801ef3c2 /src
parent6eba5ddd4248f270f96a305298b399cde65ecda7 (diff)
downloadunit-f2aa190f60cc3b6e8b4eb09b044eaea1f4087a0a.tar.gz
unit-f2aa190f60cc3b6e8b4eb09b044eaea1f4087a0a.tar.bz2
Fixed segfault with empty rule array.
Diffstat (limited to '')
-rw-r--r--src/nxt_http_route.c6
1 files changed, 3 insertions, 3 deletions
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;
}