Fix issue detected by static analysis tool 20/275720/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 31 May 2022 02:13:37 +0000 (11:13 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 31 May 2022 02:36:23 +0000 (11:36 +0900)
Change-Id: I7c87352524ffe97d5fb067c10319654227ed4a75
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
client/ma_ap_dbus.c

index 3d1d7bb7b6ce277c9800d20e9c2aa77cae5dd0be..3776c794d343fd24bd2f779894a600cee5801307 100644 (file)
@@ -60,7 +60,7 @@ static void message_port_cb(int local_port_id,
        static char pending_buffer[STREAMING_BUFFER_SIZE * 2];
        static unsigned int pending_buffer_size = 0;
 
-       char buffer[STREAMING_BUFFER_SIZE];
+       char buffer[STREAMING_BUFFER_SIZE] = {0};
        size_t size;
 
        unsigned char *v = NULL;
@@ -70,7 +70,8 @@ static void message_port_cb(int local_port_id,
                MA_SLOGE("[ERROR] bundle contains data bigger than %d : %zu", STREAMING_BUFFER_SIZE, size);
                return;
        } else {
-               memcpy(buffer, v, size);
+               if (v)
+                       memcpy(buffer, v, size);
        }
 
        memcpy(pending_buffer + pending_buffer_size, buffer, size);