From baef4432237e3c6dedc7bcbf939fc4602b5218df Mon Sep 17 00:00:00 2001 From: stesen Date: Mon, 22 Nov 2021 12:48:47 +0000 Subject: [PATCH 1/2] delete wall flags Signed-off-by: stesen --- command/BUILD.gn | 2 -- frameworks/mini/BUILD.gn | 1 - services/apphilogcat/BUILD.gn | 1 - services/hilogcat/BUILD.gn | 1 - 4 files changed, 5 deletions(-) diff --git a/command/BUILD.gn b/command/BUILD.gn index 9fac2c0..8fa3008 100755 --- a/command/BUILD.gn +++ b/command/BUILD.gn @@ -20,7 +20,6 @@ config("hilog_command_config") { lite_library("hilog_command_static") { target_type = "static_library" sources = [ "hilog_command.c" ] - cflags = [ "-Wall" ] public_configs = [ ":hilog_command_config", "//base/hiviewdfx/hilog_lite/services/apphilogcat:apphilogcat_config", @@ -34,7 +33,6 @@ lite_library("hilog_command_static") { lite_library("hilog_command_shared") { target_type = "shared_library" sources = [ "hilog_command.c" ] - cflags = [ "-Wall" ] public_configs = [ ":hilog_command_config", "//base/hiviewdfx/hilog_lite/services/apphilogcat:apphilogcat_config", diff --git a/frameworks/mini/BUILD.gn b/frameworks/mini/BUILD.gn index b450910..9ef1a3f 100755 --- a/frameworks/mini/BUILD.gn +++ b/frameworks/mini/BUILD.gn @@ -37,7 +37,6 @@ static_library("hilog_lite") { "hiview_log_limit.c", "hiview_output_log.c", ] - cflags = [ "-Wall" ] defines = [ "HIVIEW_LOG_FILE_SIZE = $ohos_hiviewdfx_hilog_lite_file_size", "LOG_LIMIT_DEFAULT = $ohos_hiviewdfx_hilog_lite_limit_level_default", diff --git a/services/apphilogcat/BUILD.gn b/services/apphilogcat/BUILD.gn index e722652..70e6f26 100755 --- a/services/apphilogcat/BUILD.gn +++ b/services/apphilogcat/BUILD.gn @@ -51,7 +51,6 @@ config("apphilogcat_config") { static_library("apphilogcat_static") { sources = [ "hiview_applogcat.c" ] - cflags = [ "-Wall" ] include_dirs = [ "//third_party/bounds_checking_function/include" ] deps = [ "//base/hiviewdfx/hilog_lite/command:hilog_command_static", diff --git a/services/hilogcat/BUILD.gn b/services/hilogcat/BUILD.gn index 6e94ad2..6375f98 100755 --- a/services/hilogcat/BUILD.gn +++ b/services/hilogcat/BUILD.gn @@ -15,7 +15,6 @@ import("//build/lite/config/component/lite_component.gni") static_library("hilogcat_static") { sources = [ "hiview_logcat.c" ] - cflags = [ "-Wall" ] include_dirs = [ "//third_party/bounds_checking_function/include" ] deps = [ "//base/hiviewdfx/hilog_lite/command:hilog_command_static", -- Gitee From 6e7afc027f004136085c56d523bb1c19163463f1 Mon Sep 17 00:00:00 2001 From: shenchenkai Date: Mon, 6 Dec 2021 17:44:02 +0800 Subject: [PATCH 2/2] Description:[fix] fix memory out of bound problem Change-Id: I60c350262c195e57722a9bd244b57e5d3c6e14b6 Signed-off-by: shenchenkai --- frameworks/mini/hiview_output_log.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frameworks/mini/hiview_output_log.c b/frameworks/mini/hiview_output_log.c index 560b305..cbaf863 100755 --- a/frameworks/mini/hiview_output_log.c +++ b/frameworks/mini/hiview_output_log.c @@ -384,6 +384,9 @@ static int32 LogCommonFmt(char *outStr, int32 outStrLen, const HiLogCommon *comm min = nowTime.tm_min; sec = nowTime.tm_sec; level = CLEAR_HASH_FLAG(commonContentPtr->level); + if (level < 0 || level >= HILOG_LV_MAX) { + level = 0; + } ret = snprintf_s(outStr, outStrLen, outStrLen - 1, "%02d-%02d %02d:%02d:%02d.%03d 0 %d %c %d/%s: ", month, day, hour, min, sec, commonContentPtr->milli, commonContentPtr->task, g_logLevelInfo[level], commonContentPtr->module, HiLogGetModuleName(commonContentPtr->module)); @@ -448,6 +451,9 @@ static int32 LogDebugValuesFmt(char *desStrPtr, int32 desLen, const HiLogContent switch (logContentPtr->commonContent.valueNumber) { case LOG_MULTI_PARA_0: ret = strncpy_s(desStrPtr, desLen, logContentPtr->commonContent.fmt, desLen - 1); + if (ret != EOK) { + ret = -1; + } break; case LOG_MULTI_PARA_1: ret = snprintf_s(desStrPtr, desLen, desLen - 1, logContentPtr->commonContent.fmt, -- Gitee