added proper file name check in play module

This commit is contained in:
Roman Arutyunyan 2012-07-23 16:38:40 +04:00
parent 4e475cccb5
commit dea898a6ea

View file

@ -706,14 +706,15 @@ ngx_rtmp_play_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
/* check for double-dot in v->name;
* we should not move out of play directory */
p = v->name;
while (*p) {
if (*p == '.' && *(p + 1) == '.') {
for (p = v->name; *p; ++p) {
if (ngx_path_separator(p[0]) &&
p[1] == '.' && p[2] == '.' &&
ngx_path_separator(p[3]))
{
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"play: bad name '%s'", v->name);
return NGX_ERROR;
}
++p;
}
if (ctx == NULL) {