From: Kwanghoon Son Date: Tue, 16 Aug 2022 07:18:01 +0000 (-0400) Subject: Fix strncat bug X-Git-Tag: submit/tizen/20220824.005052^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=21b5067659b4a9e3686a2a54be26ed9a72a7cc72;p=platform%2Fcore%2Fmultimedia%2Fvision-source.git Fix strncat bug [Version] : 0.0.6 [Issue type] : Bug fix sizeof return architecture pointer size. Change it to snprintf Change-Id: I5ff9a2b175f180516cefc459058fd059c23b7ff1 Signed-off-by: Kwanghoon Son --- diff --git a/packaging/vision-source.spec b/packaging/vision-source.spec index d7735d9..43d9f4a 100644 --- a/packaging/vision-source.spec +++ b/packaging/vision-source.spec @@ -1,6 +1,6 @@ Name: vision-source Summary: vision source -Version: 0.0.6 +Version: 0.0.7 Release: 0 Group: Multimedia/Framework License: Apache-2.0 diff --git a/src/vision_source.c b/src/vision_source.c index 5983538..acf2e19 100644 --- a/src/vision_source.c +++ b/src/vision_source.c @@ -56,6 +56,8 @@ int _vision_source_dlsym(vision_source_internal_s *handle) int _vision_source_attach(const char *backend_name, vision_source_internal_s *handle) { + LOGD("ENTER"); + LOGI("backend %s connected", backend_name); handle->dl_handle = dlopen(backend_name, RTLD_LAZY); VISION_SOURCE_NULL_ARG_CHECK(handle->dl_handle); @@ -64,11 +66,13 @@ int _vision_source_attach(const char *backend_name, dlclose(handle->dl_handle); return ret; } + LOGD("EXIT"); return VISION_SOURCE_ERROR_NONE; } int _vision_source_get_backend(char *name) { + LOGD("ENTER"); dictionary *ini = iniparser_load(INI_PATH); if (ini == NULL) { return VISION_SOURCE_ERROR_INVALID_PARAMETER; @@ -80,21 +84,21 @@ int _vision_source_get_backend(char *name) return VISION_SOURCE_ERROR_INVALID_PARAMETER; } - strncat(name, backend_name, sizeof(backend_name)); - const char *suffix = ".so"; - strncat(name, suffix, sizeof(suffix)); + snprintf(name, MAX_BACKEND_NAME, "libvision-source-%s.so", backend_name); iniparser_freedict(ini); + LOGD("EXIT"); return VISION_SOURCE_ERROR_NONE; } int vision_source_init(vision_source_h *handle) { + LOGD("ENTER"); VISION_SOURCE_NULL_ARG_CHECK(handle); vision_source_internal_s *source_handle = NULL; - char backend_tmp[MAX_BACKEND_NAME] = { "libvision-source-" }; + char backend_tmp[MAX_BACKEND_NAME]; int ret = _vision_source_get_backend(backend_tmp); if (ret != VISION_SOURCE_ERROR_NONE) { return ret; @@ -111,11 +115,13 @@ int vision_source_init(vision_source_h *handle) } *handle = source_handle; + LOGD("EXIT"); return VISION_SOURCE_ERROR_NONE; } int vision_source_exit(vision_source_h handle) { + LOGD("ENTER"); VISION_SOURCE_NULL_ARG_CHECK(handle); vision_source_internal_s *source_handle = (vision_source_internal_s *) handle; @@ -133,6 +139,7 @@ int vision_source_exit(vision_source_h handle) } free(source_handle); + LOGD("EXIT"); return VISION_SOURCE_ERROR_NONE; }