fix msm-plugin.c svace issue: make sure dupPath is not NULL before strchr() 29/307229/2 accepted/tizen_base_toolchain accepted/tizen_base_x accepted/tizen_base_x_asan accepted/tizen/base/20240311.130435 accepted/tizen/base/toolchain/20240424.234753 accepted/tizen/base/x/20240311.213619 accepted/tizen/base/x/asan/20240412.003225
authorwangbiao <biao716.wang@samsung.com>
Wed, 6 Mar 2024 07:38:32 +0000 (16:38 +0900)
committerwangbiao <biao716.wang@samsung.com>
Wed, 6 Mar 2024 07:54:02 +0000 (16:54 +0900)
fix msmmanifest.c svace issue: make sure ac_domain->name not NULL before sprintf()
Change-Id: I2bf7a71e478569fec4d101e41c42776d9c7916a3
Signed-off-by: wangbiao <biao716.wang@samsung.com>
plugins/msm-plugin.c
plugins/msmmanifest.c

index 4fe1c1a..9db346b 100644 (file)
@@ -598,6 +598,7 @@ rpmRC msm_plugin_fsm_file_init(const char* path, mode_t mode)
     if (!path) return RPMRC_FAIL; 
 
     dupPath = strdup(path);
+    if (!dupPath) return RPMRC_FAIL;
     cleanedPath = strchr(dupPath, ';');
     if (cleanedPath)
         *cleanedPath = '\0';
index 73f7c4b..76bfbd9 100644 (file)
@@ -452,6 +452,7 @@ static int msmProcessProvide(xmlTextReaderPtr reader, provide_x *provide, sw_sou
                 if (mfx && !provide->name) {
                     ac_domain->name = malloc(strlen(mfx->name) + 2 +
                                              strlen(name) + 1);
+                   if (!ac_domain->name) return -1;
                     sprintf((char *)ac_domain->name, "%s::%s", mfx->name, name);
                     msmFreePointer((void**)&name);
                }