pmqos: Fix issue when the part of scenario name is same with supported scenario 31/240531/1
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 7 Aug 2020 06:22:56 +0000 (15:22 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 7 Aug 2020 06:37:59 +0000 (15:37 +0900)
If the part of scenario name sent from client is same with among
the supported scenario name, strncmp() causes the issue.
In order to fix this issue, compare the full scenario name with strcmp():

Change-Id: Ibc712b0b4be2cb752506ac7094b27abd88e587b5
Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pmqos/pmqos.c

index e14e88259ae60ed1be16bbf7fb1ae28ff57b6f22..2ed67f7b13072d9233eec174b65799622373b0ce 100644 (file)
@@ -175,8 +175,7 @@ static gboolean dbus_cb_pmqos_legacy_scenario(SystemPassPmqos *obj,
                        for (i = 0; i < g_pmqos->num; i++) {
                                name = g_pmqos->list[i].name;
                                support = g_pmqos->list[i].support;
-                               if (!strncmp(name, name_from, strlen(name)) &&
-                                               support) {
+                               if (!strcmp(name, name_from) && support) {
                                        ret = 0;
                                        break;
                                }
@@ -352,7 +351,7 @@ static int pmqos_cancel(const char *name)
        pmqos_head = g_list_remove(pmqos_head, (gconstpointer)cpu);
        free(cpu);
 
-       if (strncmp(unlock_timer_owner.name, name, strlen(name)))
+       if (strcmp(unlock_timer_owner.name, name))
                goto out;
        /* undata cpu */
        pmqos_unlock_timeout_update();