mirror of
https://github.com/arut/nginx-rtmp-module.git
synced 2025-08-06 15:00:18 +08:00
added path checks
This commit is contained in:
@ -301,6 +301,7 @@ ngx_rtmp_record_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
|
|||||||
{
|
{
|
||||||
ngx_rtmp_record_app_conf_t *racf;
|
ngx_rtmp_record_app_conf_t *racf;
|
||||||
ngx_rtmp_record_ctx_t *ctx;
|
ngx_rtmp_record_ctx_t *ctx;
|
||||||
|
u_char *p;
|
||||||
|
|
||||||
racf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_record_module);
|
racf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_record_module);
|
||||||
|
|
||||||
@ -323,6 +324,17 @@ ngx_rtmp_record_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
|
|||||||
ngx_memcpy(ctx->name, v->name, sizeof(ctx->name));
|
ngx_memcpy(ctx->name, v->name, sizeof(ctx->name));
|
||||||
ngx_memcpy(ctx->args, v->args, sizeof(ctx->args));
|
ngx_memcpy(ctx->args, v->args, sizeof(ctx->args));
|
||||||
|
|
||||||
|
/* terminate name on /../ */
|
||||||
|
for (p = ctx->name; *p; ++p) {
|
||||||
|
if (ngx_path_separator(p[0]) &&
|
||||||
|
p[1] == '.' && p[2] == '.' &&
|
||||||
|
ngx_path_separator(p[3]))
|
||||||
|
{
|
||||||
|
*p = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ngx_rtmp_record_open(s) != NGX_OK) {
|
if (ngx_rtmp_record_open(s) != NGX_OK) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user