Fix issue detected by static analysis tool 55/278655/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 25 Jul 2022 00:49:52 +0000 (09:49 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 25 Jul 2022 00:53:20 +0000 (09:53 +0900)
(#1 of 1): Explicit null dereferenced (FORWARD_NULL)
3. var_deref_model: Passing null pointer v to memcpy, which dereferences it

Change-Id: I3bbae39553aa34ebd80a319d6f731c4f2074e95d
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
client/ma_dbus.c
client/ma_ui.c

index 01ee6a774784c1bd36552abc2e012e5ea8f2cf5d..a63b0827ac6d8071921399993de197dc68225496 100644 (file)
@@ -85,7 +85,8 @@ static void message_port_cb(int local_port_id,
                MA_SLOGE("[ERROR] bundle contains data bigger than %d : %zu", STREAMING_BUFFER_SIZE, size); //LCOV_EXCL_LINE
                return;
        } else {
-               memcpy(buffer, v, size);
+               if (v)
+                       memcpy(buffer, v, size);
        }
 
        memcpy(pending_buffer + pending_buffer_size, buffer, size);
index 216cd1cbab4443331b92b4350d0a958aba578da9..6257551577bd61dbdb35e17488b6ddcb6a265d09 100644 (file)
@@ -725,8 +725,8 @@ int ma_ui_set_default_assistant(const char* app_id)
                return MA_ERROR_INVALID_STATE;
        }
 
-       ret = -1;
-/*     ret = ma_config_mgr_set_default_assistant(app_id);
+/*     ret = -1;
+       ret = ma_config_mgr_set_default_assistant(app_id);
        if (0 != ret) {
                MAUI_SLOGE("[UI ERROR] Fail to set default assistant")_;
        }