From 29dfda882aa06bbb20278999b8b9ad48a1d348b7 Mon Sep 17 00:00:00 2001 From: Roman Arutyunyan Date: Thu, 28 Nov 2013 17:14:39 +0400 Subject: [PATCH] fixed using raw non-null-terminated strings from config parser in syscalls --- dash/ngx_rtmp_dash_module.c | 4 +++- hls/ngx_rtmp_hls_module.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dash/ngx_rtmp_dash_module.c b/dash/ngx_rtmp_dash_module.c index d1346a6..3bc81e5 100644 --- a/dash/ngx_rtmp_dash_module.c +++ b/dash/ngx_rtmp_dash_module.c @@ -742,7 +742,9 @@ ngx_rtmp_ensure_directory(ngx_rtmp_session_t *s) dacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_dash_module); - if (ngx_file_info(dacf->path.data, &fi) == NGX_FILE_ERROR) { + *ngx_snprintf(path, sizeof(path) - 1, "%V", &dacf->path) = 0; + + if (ngx_file_info(path, &fi) == NGX_FILE_ERROR) { if (ngx_errno != NGX_ENOENT) { ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno, diff --git a/hls/ngx_rtmp_hls_module.c b/hls/ngx_rtmp_hls_module.c index 10bda54..3b5319a 100644 --- a/hls/ngx_rtmp_hls_module.c +++ b/hls/ngx_rtmp_hls_module.c @@ -313,7 +313,9 @@ ngx_rtmp_hls_create_parent_dir(ngx_rtmp_session_t *s) ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0, "hls: creating target folder: '%V'", &hacf->path); - if (ngx_create_dir(hacf->path.data, NGX_RTMP_HLS_DIR_ACCESS) != NGX_OK) { + *ngx_snprintf(path, sizeof(path) - 1, "%V", &hacf->path) = 0; + + if (ngx_create_dir(path, NGX_RTMP_HLS_DIR_ACCESS) != NGX_OK) { err = ngx_errno; if (err != NGX_EEXIST) { ngx_log_error(NGX_LOG_ERR, s->connection->log, err,