Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 6226:4bc94faeff66
Fixed segfault with try_files introduced by c985d90a8d1f.
If alias was used in a location given by a regular expression,
nginx used to do wrong thing in try_files if a location name (i.e.,
regular expression) was an exact prefix of URI. The following
configuration triggered a segmentation fault on a request to "/mail":
location ~ /mail {
alias /path/to/directory;
try_files $uri =404;
}
Reported by Per Hansson.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 16 Aug 2015 10:51:16 +0300 |
parents | 8b6fa4842133 |
children | bd55d75a1410 |
comparison
equal
deleted
inserted
replaced
6225:3b6d69857de2 | 6226:4bc94faeff66 |
---|---|
1237 | 1237 |
1238 path.len = e.pos - path.data; | 1238 path.len = e.pos - path.data; |
1239 | 1239 |
1240 *e.pos = '\0'; | 1240 *e.pos = '\0'; |
1241 | 1241 |
1242 if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) { | 1242 if (alias && alias != NGX_MAX_SIZE_T_VALUE |
1243 && ngx_strncmp(name, clcf->name.data, alias) == 0) | |
1244 { | |
1243 ngx_memmove(name, name + alias, len - alias); | 1245 ngx_memmove(name, name + alias, len - alias); |
1244 path.len -= alias; | 1246 path.len -= alias; |
1245 } | 1247 } |
1246 } | 1248 } |
1247 | 1249 |