From 1edfcdb82af1b1647f4e3fa6abbad40c4c9a0354 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 31 May 2022 11:13:37 +0900 Subject: [PATCH] Fix issue detected by static analysis tool Change-Id: I7c87352524ffe97d5fb067c10319654227ed4a75 Signed-off-by: Jihoon Kim --- client/ma_ap_dbus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/ma_ap_dbus.c b/client/ma_ap_dbus.c index 3d1d7bb..3776c79 100644 --- a/client/ma_ap_dbus.c +++ b/client/ma_ap_dbus.c @@ -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); -- 2.34.1