From 040fae671fa292ec5f5f23d6e07bac1c2a58c099 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Tue, 28 Jun 2022 11:49:50 +0900 Subject: [PATCH] Fix unsafe code for security Change-Id: If703ccf00bd8da35867c5f00bfd3e0ab0c1fde0b --- assistant-parser/src/ma_assistant_parser.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/assistant-parser/src/ma_assistant_parser.c b/assistant-parser/src/ma_assistant_parser.c index dc3971c..b9a7ab4 100644 --- a/assistant-parser/src/ma_assistant_parser.c +++ b/assistant-parser/src/ma_assistant_parser.c @@ -326,6 +326,11 @@ static void __insert_language_from_metadata(xmlNodePtr root, const char *languag xmlNodePtr languages_node = NULL; xmlNodePtr lang_node = NULL; + if (tmp_lang == NULL) { + LOGE("[ERROR] Fail to allocate memory"); + return; + } + languages_node = xmlNewNode(NULL, (const xmlChar*)MA_TAG_ASSISTANT_LANGUAGE_SET); if (languages_node) { lang = strsep(&tmp_lang, ","); @@ -401,6 +406,11 @@ static void __insert_wakeup_engine_from_metadata(xmlNodePtr root, const char *wa xmlNodePtr wakeup_engines_node = NULL; xmlNodePtr wakeup_engine_node = NULL; + if (tmp_wakeup_engine == NULL) { + LOGE("[ERROR] Fail to allocate memory"); + return; + } + char* engine = NULL; wakeup_engines_node = xmlNewNode(NULL, (const xmlChar*)MA_TAG_ASSISTANT_WAKEUP_ENGINE_SET); if (wakeup_engines_node) { -- 2.34.1