diff options
author | Igor Sysoev <igor@sysoev.ru> | 2019-05-30 15:33:51 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2019-05-30 15:33:51 +0300 |
commit | 3aaebe4169f80707e495f1111b7ab9c2dcb79b6d (patch) | |
tree | 4d71e1dbfc5587ab8b9bd79d02fd293fca4a2454 /src/nxt_http_route.c | |
parent | f2aa190f60cc3b6e8b4eb09b044eaea1f4087a0a (diff) | |
download | unit-3aaebe4169f80707e495f1111b7ab9c2dcb79b6d.tar.gz unit-3aaebe4169f80707e495f1111b7ab9c2dcb79b6d.tar.bz2 |
Fixed segfault with empty routes array.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_http_route.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/nxt_http_route.c b/src/nxt_http_route.c index 2a41d7fa..21e83ecb 100644 --- a/src/nxt_http_route.c +++ b/src/nxt_http_route.c @@ -616,14 +616,13 @@ nxt_http_route_find(nxt_http_routes_t *routes, nxt_str_t *name) route = &routes->route[0]; end = route + routes->items; - do { + while (route < end) { if (nxt_strstr_eq(&(*route)->name, name)) { return *route; } route++; - - } while (route < end); + } return NULL; } @@ -681,12 +680,11 @@ nxt_http_routes_cleanup(nxt_task_t *task, nxt_http_routes_t *routes) route = &routes->route[0]; end = route + routes->items; - do { + while (route < end) { nxt_http_route_cleanup(task, *route); route++; - - } while (route < end); + } } } @@ -699,12 +697,11 @@ nxt_http_route_cleanup(nxt_task_t *task, nxt_http_route_t *route) match = &route->match[0]; end = match + route->items; - do { + while (match < end) { nxt_http_pass_cleanup(task, &(*match)->pass); match++; - - } while (match < end); + } } |