From 89222eae2fbcc7907a78f51a082b14d483ebe3d5 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Mon, 17 Apr 2017 17:13:55 +0900 Subject: [PATCH] Fix Svace issues [Version] 0.10.4 [Profile] Mobile, TV [Issue Type] Fix Svace issue Change-Id: I7e0e1c31e992c366aae1550ed7be2532e3b26dff --- packaging/libmm-transcode.spec | 2 +- transcode/include/mm_transcode.h | 1 - transcode/mm_transcode_seek.c | 12 ++++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packaging/libmm-transcode.spec b/packaging/libmm-transcode.spec index 6f8747d..03f5d0e 100644 --- a/packaging/libmm-transcode.spec +++ b/packaging/libmm-transcode.spec @@ -1,6 +1,6 @@ Name: libmm-transcode Summary: Multimedia Framework Video Transcode Library -Version: 0.10.3 +Version: 0.10.4 Release: 0 Group: System/Libraries License: Apache-2.0 diff --git a/transcode/include/mm_transcode.h b/transcode/include/mm_transcode.h index b710b2e..740875b 100644 --- a/transcode/include/mm_transcode.h +++ b/transcode/include/mm_transcode.h @@ -222,7 +222,6 @@ mm_transcode_get_supported_video_encoder(mm_transcode_support_type_callback type int mm_transcode_get_supported_audio_encoder(mm_transcode_support_type_callback type_callback, void *user_param); - #ifdef __cplusplus__ }; #endif diff --git a/transcode/mm_transcode_seek.c b/transcode/mm_transcode_seek.c index c3e0c72..26d1788 100755 --- a/transcode/mm_transcode_seek.c +++ b/transcode/mm_transcode_seek.c @@ -195,7 +195,8 @@ GstAutoplugSelectResult _mm_cb_decode_bin_autoplug_select(GstElement *element, G return GST_AUTOPLUG_SELECT_TRY; } memset(handle->property->audiodecodename, 0, ENC_BUFFER_SIZE); - strncpy(handle->property->audiodecodename, feature_name, strlen(feature_name)); + strncpy(handle->property->audiodecodename, feature_name, ENC_BUFFER_SIZE - 1); + handle->property->audiodecodename[ENC_BUFFER_SIZE] = '\0'; debug_log("[audio decode name %s : %s]", caps_str, handle->property->audiodecodename); } @@ -211,7 +212,8 @@ GstAutoplugSelectResult _mm_cb_decode_bin_autoplug_select(GstElement *element, G return GST_AUTOPLUG_SELECT_TRY; } memset(handle->property->videodecodename, 0, ENC_BUFFER_SIZE); - strncpy(handle->property->videodecodename, feature_name, strlen(feature_name)); + strncpy(handle->property->videodecodename, feature_name, ENC_BUFFER_SIZE - 1); + handle->property->videodecodename[ENC_BUFFER_SIZE] = '\0'; debug_log("[video decode name %s : %s]", caps_str, handle->property->videodecodename); } @@ -652,7 +654,8 @@ static int _mm_transcode_exec(handle_s *handle, handle_param_s *param) } memset(handle->param->outputfile, 0, BUFFER_SIZE); - strncpy(handle->param->outputfile, param->outputfile, strlen(param->outputfile)); + strncpy(handle->param->outputfile, param->outputfile, BUFFER_SIZE - 1); + handle->param->outputfile[BUFFER_SIZE] = '\0'; handle->param->seeking = param->seeking; handle->param->async_done = FALSE; @@ -1006,7 +1009,8 @@ int _mm_transcode_set_handle_parameter(handle_param_s *param, unsigned int resol return MM_ERROR_TRANSCODE_NO_FREE_SPACE; } memset(param->outputfile, 0, BUFFER_SIZE); - strncpy(param->outputfile, out_Filename, strlen(out_Filename)); + strncpy(param->outputfile, out_Filename, BUFFER_SIZE - 1); + param->outputfile[BUFFER_SIZE] = '\0'; debug_log("%s(%d)", param->outputfile, strlen(out_Filename)); } else { debug_error("out_Filename error"); -- 2.7.4