Fix Svace issue of LIB.BAD_LOAD_PATH and LIB.INSECURE_STRNCMP 03/320503/2 accepted/tizen_unified_x_asan accepted/tizen/unified/20241118.155148 accepted/tizen/unified/x/20241218.032534 accepted/tizen/unified/x/asan/20241224.004300
authorYoungHun Kim <yh8004.kim@samsung.com>
Mon, 18 Nov 2024 01:46:18 +0000 (10:46 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Mon, 18 Nov 2024 01:51:14 +0000 (10:51 +0900)
Change-Id: I0a1f753dde472241bd7474d7da3b1ef7038d71c3

packaging/rscmgr-service.spec
src/CResourceService.cpp
src/gen_rm_msgq.cpp

index 7fe386e48f1441d9583feeb46080d4d151d8ecc6..90e4baba8d21ee24435d0dce9b61c954ed045d96 100644 (file)
@@ -1,7 +1,7 @@
 Name: rscmgr-service
 Summary: Daemon for resource manager
 Version: 0.1
-Release: 11
+Release: 12
 Group:   Multimedia/Libraries
 License: Apache-2.0
 Source0: %{name}-%{version}.tar.gz
index 3b2b140c56b1bbf9284b57e86acb6001117ac91c..5e0eff7b7d509b445aa3def2c019bc0a7045efa2 100644 (file)
@@ -31,8 +31,9 @@
 #include <CResourceManager.h>
 
 #define RM_SERVER_SMART_DEADLOCK_WATCHDOG_TIME_90_SEC 90
-#define RM_SERVER_WATCHDOG_TIME_10000_MSEC  10000
+#define RM_SERVER_WATCHDOG_TIME_10000_MSEC 10000
 #define RM_SERVER_INVALID_TABLE_TIME_30000_MSEC 30000
+#define RESOURCED_LIB_PATH LIBDIR "/libproc-stat.so.5"
 
 int CResourceService::Init(GMainLoop *main_loop)
 {
@@ -96,7 +97,7 @@ void CResourceService::SetVIPProcess(void)
        void *handle;
        void (*vip_func)(void);
 
-       handle = dlopen("/lib/libproc-stat.so.5", RTLD_LAZY);
+       handle = dlopen(RESOURCED_LIB_PATH, RTLD_LAZY);
 
        if (!handle) {
                SERVER_ERR("failed to open libproc-stat.so (%s)", dlerror());
index 03d806faf7b7fe911beef14ec4e58b2beb56df37..ef72a8b0ba9977c571cdab03cb604afa2bf0a8b7 100644 (file)
@@ -63,7 +63,7 @@ static int _is_realpath(const char *path)
                goto out;
        }
 
-       if (strncmp(path, rms_realpath, len_path)) {
+       if (strncmp(path, rms_realpath, len_path + 1)) {
                SERVER_ERR("path mismatch(%s:%s)", path, rms_realpath);
                result = 0;
                goto out;