Fix crash when assistant provides no wakeup engine info
authorJi-hoon Lee <dalton.lee@samsung.com>
Mon, 25 Mar 2019 07:48:17 +0000 (16:48 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 26 Mar 2019 07:26:12 +0000 (16:26 +0900)
Change-Id: Ibc6405815abee190fba0866cbddee9e86f11214c

src/multi_assistant_service.c

index c35f75a..c70db08 100644 (file)
@@ -444,8 +444,13 @@ int __mas_assistant_info_cb(const char* appid, const char* name,
                }
 
                MAS_LOGD("wakeup_engine(%s)", wakeup_engine);
-               strncpy(g_maclient_info[index].wakeup_engine, wakeup_engine, MAX_APPID_LEN);
-               g_maclient_info[index].wakeup_engine[MAX_APPID_LEN - 1] = '\0';
+               if (wakeup_engine) {
+                       strncpy(g_maclient_info[index].wakeup_engine, wakeup_engine, MAX_APPID_LEN);
+                       g_maclient_info[index].wakeup_engine[MAX_APPID_LEN - 1] = '\0';
+               } else {
+                       g_maclient_info[index].wakeup_engine[0] = '\0';
+                       MAS_LOGW("Wakeup engine information not provided for : %s", appid);
+               }
        } else {
                MAS_LOGD("Couldn't find an empty slot for storing assistant info");
        }