mirror of
https://github.com/nginx/nginx.git
synced 2025-06-12 21:52:41 +08:00
fix cache path slot
This commit is contained in:
parent
1dcaa97ccc
commit
43f3f4a73d
@ -1357,13 +1357,12 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
|
|
||||||
if (ngx_strncmp(value[i].data, "levels=", 7) == 0) {
|
if (ngx_strncmp(value[i].data, "levels=", 7) == 0) {
|
||||||
|
|
||||||
n = 0;
|
|
||||||
p = value[i].data + 7;
|
p = value[i].data + 7;
|
||||||
last = value[i].data + value[i].len;
|
last = value[i].data + value[i].len;
|
||||||
|
|
||||||
while (p < last) {
|
for (n = 0; n < 3 && p < last; n++) {
|
||||||
|
|
||||||
if (*p > '0' && *p < '6') {
|
if (*p > '0' && *p < '3') {
|
||||||
|
|
||||||
cache->path->level[n] = *p++ - '0';
|
cache->path->level[n] = *p++ - '0';
|
||||||
cache->path->len += cache->path->level[n] + 1;
|
cache->path->len += cache->path->level[n] + 1;
|
||||||
@ -1372,20 +1371,11 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*p++ == ':') {
|
if (*p++ == ':' && n < 2 && p != last) {
|
||||||
|
|
||||||
if (n > 2) {
|
|
||||||
goto invalid_levels;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cache->path->level[n] == 0) {
|
|
||||||
goto invalid_levels;
|
|
||||||
}
|
|
||||||
|
|
||||||
n++;
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goto invalid_levels;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto invalid_levels;
|
goto invalid_levels;
|
||||||
|
Loading…
Reference in New Issue
Block a user