Fix static analysis issue 12/314312/1
authorInkyun Kil <inkyun.kil@samsung.com>
Wed, 10 Jul 2024 05:14:08 +0000 (14:14 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Wed, 10 Jul 2024 05:14:08 +0000 (14:14 +0900)
- LIB.INSECURE_STRNCMP

Change-Id: Idc0bc8525cc60d114660547375f71ddde7691ca7
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
src/data_control_provider.c

index 208a4915594c223ad303efa8b87b7b0681dbc2d4..b58c7faa7310fe86facca77090e2c5ff1be4a122 100644 (file)
@@ -1614,8 +1614,7 @@ int __provider_process(bundle *b, int fd, const char *consumer_appid)
        }
 
        caller_appid = (char *)bundle_get_val(b, AUL_K_CALLER_APPID);
-       if (caller_appid && strncmp(caller_appid,
-                               consumer_appid, strlen(consumer_appid)) != 0) {
+       if (caller_appid && strcmp(caller_appid, consumer_appid) != 0) {
                _LOGE("The passed appid(%s) is different from the registered appid(%s).",
                                caller_appid, consumer_appid);
                return DATA_CONTROL_ERROR_NONE;
@@ -1701,10 +1700,10 @@ int __provider_process(bundle *b, int fd, const char *consumer_appid)
                const char *order = arg_list[i++];  /* order */
                _LOGD("where: %s, order: %s", where, order);
 
-               if (strncmp(where, DATACONTROL_EMPTY, strlen(DATACONTROL_EMPTY)) == 0)
+               if (strcmp(where, DATACONTROL_EMPTY) == 0)
                        where = NULL;
 
-               if (strncmp(order, DATACONTROL_EMPTY, strlen(DATACONTROL_EMPTY)) == 0)
+               if (strcmp(order, DATACONTROL_EMPTY) == 0)
                        order = NULL;
 
                const char *page_number = arg_list[i++];
@@ -1750,7 +1749,7 @@ int __provider_process(bundle *b, int fd, const char *consumer_appid)
                } else {
                        const char *where = arg_list[PACKET_INDEX_UPDATEWHERE];
                        _LOGD("UPDATE from where: %s", where);
-                       if (strncmp(where, DATACONTROL_EMPTY, strlen(DATACONTROL_EMPTY)) == 0)
+                       if (strcmp(where, DATACONTROL_EMPTY) == 0)
                                where = NULL;
                        if (sql_callback.update_cb) {
                                sql_callback.update_cb(
@@ -1792,7 +1791,7 @@ int __provider_process(bundle *b, int fd, const char *consumer_appid)
        {
                const char *where = arg_list[PACKET_INDEX_DELETEWHERE];
                _LOGD("DELETE from where: %s", where);
-               if (strncmp(where, DATACONTROL_EMPTY, strlen(DATACONTROL_EMPTY)) == 0)
+               if (strcmp(where, DATACONTROL_EMPTY) == 0)
                        where = NULL;
                if (sql_callback.delete_cb) {
                        sql_callback.delete_cb(