svace:change strcat to strncat 17/87717/1 accepted/tizen/common/20160912.181324 submit/tizen/20160912.053251
authorsanghyeok.oh <sanghyeok.oh@samsung.com>
Fri, 9 Sep 2016 07:34:17 +0000 (16:34 +0900)
committersanghyeok.oh <sanghyeok.oh@samsung.com>
Fri, 9 Sep 2016 07:34:29 +0000 (16:34 +0900)
Change-Id: I546599c8f5c850eda6374a792492e7db1e9dcf7a
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
src/internal/policy.cpp

index bed844a..5251fd2 100644 (file)
@@ -462,8 +462,8 @@ const char* MatchItemSR::toString(char* str) const {
        char tmp[MAX_LOG_LINE];
        tmp[0]  = 0;
        for (int i = 0; i < names_num; i++) {
-               std::strcat(tmp, names[i].name);
-               std::strcat(tmp, " ");
+               std::strncat(tmp, names[i].name, sizeof(tmp) - strlen(tmp) - 1);
+               std::strncat(tmp, " ", sizeof(tmp) - strlen(tmp) - 1);
        }
        snprintf(str, MAX_LOG_LINE, "matcher: services(%s), interface(%s), member(%s), path(%s), type(%s), direction(%s)", tmp, interface, member, path, __message_type_to_str(type), __message_dir_to_str(direction) );
        return str;