From: Suyeon Hwang Date: Tue, 26 Sep 2023 07:40:25 +0000 (+0900) Subject: Use safe function to avoid security issues X-Git-Tag: accepted/tizen/unified/20230926.161018~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ef0003c3fec11d70079af6a5a74288f6a303f9d;p=platform%2Fcore%2Fuifw%2Ftts.git Use safe function to avoid security issues Change-Id: I9d62fb45b44eaaf223aba5c6f58ed504ac6e3027 Signed-off-by: Suyeon Hwang --- diff --git a/server/ttsd_server.c b/server/ttsd_server.c index 0efac818..fd97cf35 100644 --- a/server/ttsd_server.c +++ b/server/ttsd_server.c @@ -124,42 +124,14 @@ static void write_debugger_information(speak_data_s *speak_data, const char *app if (true != ttsd_engine_select_valid_voice(speak_data->lang, speak_data->vctype, &temp_lang, &temp_type)) { SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to select default voice"); } else { - char vcType[10]; - sprintf(vcType, "%d", temp_type); + char value_buffer[2048] = {0, }; + snprintf(value_buffer, 2048, + "client=%s|type=%d|speed=%d|language=%s|text=%s|error=%d", + appid, temp_type, speak_data->speed, temp_lang, speak_data->text, ret); - char ttsSpeed[10]; - sprintf(ttsSpeed, "%d", speak_data->speed); + SLOG(LOG_INFO, tts_tag(), "keyVal : %s", value_buffer); - char errorRet[10]; - sprintf(errorRet, "%d", ret); - - char keyVal[500] = {0,}; - strcat(keyVal,"client="); - strcat(keyVal,appid); - strcat(keyVal,"|"); - - strcat(keyVal,"type="); - strcat(keyVal,vcType); - strcat(keyVal,"|"); - - strcat(keyVal,"speed="); - strcat(keyVal,ttsSpeed); - strcat(keyVal,"|"); - - strcat(keyVal,"language="); - strcat(keyVal,temp_lang); - strcat(keyVal,"|"); - - strcat(keyVal,"text="); - strcat(keyVal,speak_data->text); - strcat(keyVal,"|"); - - strcat(keyVal,"error="); - strcat(keyVal,errorRet); - - SLOG(LOG_INFO, tts_tag(), "keyVal : %s",keyVal); - - if (0 != vconf_set_str("db/ttsdebugger/tts_info", keyVal)) { + if (0 != vconf_set_str("db/ttsdebugger/tts_info", value_buffer)) { SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to set vconf key db/ttsdebugger/tts_info"); } } @@ -188,7 +160,7 @@ static void __synthesis(unsigned int uid) return; } - char appid[1024] = {0, }; + char appid[512] = {0, }; if (0 != aul_app_get_appid_bypid(pid, appid, sizeof(appid) - 1)) { SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get app id"); }