Get library name from vconf 25/269025/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Thu, 6 Jan 2022 11:31:56 +0000 (20:31 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Thu, 6 Jan 2022 11:31:56 +0000 (20:31 +0900)
Current code tries to get full path of dependency module from vconf of system. This means that
framework allows to use annonymous library which is installed on any location. However, this
behavior might allow to access malicious code and this would become critical problem.

To solve this issue, this patch fix that the code gets the file name of library from the vconf.
By this patch, all dependency module libraries should be installed predetermined location.
The location is read only directory, so malicious code can not be located.

Change-Id: I5ab83609229a0fe84b152894b3935d586859c98a
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
server/dependency_audio_manager.cpp
server/dependency_audio_manager.h

index 8e2f6b0..f10abaa 100644 (file)
@@ -41,13 +41,13 @@ int dependency_audio_manager_initialize(sound_stream_info_h stream_info_h, depen
 
        const int FILEPATH_LEN = 512;
        char filepath[FILEPATH_LEN] = {'\0', };
-       char *vconf_str = vconf_get_str(VCD_DEPENDENCY_MODULE_PATH);
-       if (vconf_str) {
-               snprintf(filepath, FILEPATH_LEN - 1, "%s", vconf_str);
-               free(vconf_str);
+       const char *module_directory_path = VCD_DEPENDENCY_MODULE_DIRECTORY_PATH;
+       char *module_library_name = vconf_get_str(VCD_DEPENDENCY_MODULE_NAME);
+       if (module_library_name) {
+               snprintf(filepath, FILEPATH_LEN - 1, "%s/%s", module_directory_path, module_library_name);
+               free(module_library_name);
        } else {
-               const char *default_path = VCD_DEPENDENCY_DEFAULT_PATH;
-               snprintf(filepath, FILEPATH_LEN - 1, "%s/%s", default_path, VCD_DEPENDENCY_DEFAULT_FILENAME);
+               snprintf(filepath, FILEPATH_LEN - 1, "%s/%s", module_directory_path, VCD_DEPENDENCY_DEFAULT_FILENAME);
        }
        filepath[FILEPATH_LEN - 1] = '\0';
 
index 9568379..073ebf4 100644 (file)
@@ -30,13 +30,13 @@ extern "C" {
 /**************************************************************************************
  *** Definitions for dependencies
  *************************************************************************************/
-#define VCD_DEPENDENCY_DEFAULT_PATH tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_SHARE"), "voice/vc/1.0/dependency-audio-manager")
+#define VCD_DEPENDENCY_MODULE_DIRECTORY_PATH tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_SHARE"), "voice/vc/1.0/dependency-audio-manager")
 #ifdef TV_PRODUCT
 #define VCD_DEPENDENCY_DEFAULT_FILENAME "libaudio-manager-vd.so"
 #else
 #define VCD_DEPENDENCY_DEFAULT_FILENAME "libvc-audio-manager.so"
 #endif
-#define VCD_DEPENDENCY_MODULE_PATH "db/voice/vc/dependency_module_path"
+#define VCD_DEPENDENCY_MODULE_NAME "db/voice/vc/dependency_module_name"
 
 
 typedef int (*dependency_audio_manager_feed_audio_data)(const void* data, const unsigned int length);