From: Gilbok Lee Date: Thu, 4 May 2017 08:00:27 +0000 (+0900) Subject: Fix svace issues X-Git-Tag: submit/tizen/20170508.044749^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F48%2F128048%2F2;p=platform%2Fcore%2Fmultimedia%2Flibmm-transcode.git Fix svace issues [Version] 0.10.6 [Profile] Mobile, TV [Issue Type] Fix bugs (Migration, Add features, Refactoring, Script etc.) Change-Id: Ice2b6df5dcd01a2cd23e7c3857025a86ae112624 --- diff --git a/packaging/libmm-transcode.spec b/packaging/libmm-transcode.spec index 7a42752..f0164b2 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.5 +Version: 0.10.6 Release: 0 Group: System/Libraries License: Apache-2.0 diff --git a/transcode/mm_transcode_seek.c b/transcode/mm_transcode_seek.c index 9ea3b94..cc5dbc3 100755 --- a/transcode/mm_transcode_seek.c +++ b/transcode/mm_transcode_seek.c @@ -195,8 +195,7 @@ 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, ENC_BUFFER_SIZE - 1); - handle->property->audiodecodename[ENC_BUFFER_SIZE] = '\0'; + g_strlcpy(handle->property->audiodecodename, feature_name, ENC_BUFFER_SIZE); debug_log("[audio decode name %s : %s]", caps_str, handle->property->audiodecodename); } @@ -212,8 +211,7 @@ 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, ENC_BUFFER_SIZE - 1); - handle->property->videodecodename[ENC_BUFFER_SIZE] = '\0'; + g_strlcpy(handle->property->videodecodename, feature_name, ENC_BUFFER_SIZE); debug_log("[video decode name %s : %s]", caps_str, handle->property->videodecodename); } @@ -654,8 +652,7 @@ 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, BUFFER_SIZE - 1); - handle->param->outputfile[BUFFER_SIZE] = '\0'; + g_strlcpy(handle->param->outputfile, param->outputfile, BUFFER_SIZE); handle->param->seeking = param->seeking; handle->param->async_done = FALSE; @@ -886,8 +883,7 @@ static void _mm_transcode_video_capsfilter_set_parameter(GstCaps *caps, handle_s debug_log("mime: %s", handle->property->mime); const gchar *format = gst_structure_get_string(_str, "format"); - strncpy(handle->property->format, format, sizeof(handle->property->format)); - handle->property->format[sizeof(handle->property->format) - 1] = '\0'; + g_strlcpy(handle->property->format, format, sizeof(handle->property->format)); switch (gst_video_format_from_string(handle->property->format)) { case GST_VIDEO_FORMAT_I420: @@ -963,7 +959,7 @@ int _mm_transcode_set_handle_element(handle_s *handle, const char *in_Filename, handle->property->sourcefile = malloc(sizeof(char) * BUFFER_SIZE); if (handle->property->sourcefile) { memset(handle->property->sourcefile, 0, BUFFER_SIZE); - strncpy(handle->property->sourcefile, in_Filename, strlen(in_Filename)); + g_strlcpy(handle->property->sourcefile, in_Filename, BUFFER_SIZE); debug_log("%s", handle->property->sourcefile); } else { debug_error("[ERROR] malloc fail of sourcefile"); @@ -1009,8 +1005,7 @@ 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, BUFFER_SIZE - 1); - param->outputfile[BUFFER_SIZE] = '\0'; + g_strlcpy(param->outputfile, out_Filename, BUFFER_SIZE); debug_log("%s(%d)", param->outputfile, strlen(out_Filename)); } else { debug_error("out_Filename error");