diff --git a/inspector/BUILD.gn b/inspector/BUILD.gn index 4cd8bd53eea84e303ff7614c03477c8cf67df222..eccccb5da7b9e378d04d6e26c153fbe95dfb19f9 100644 --- a/inspector/BUILD.gn +++ b/inspector/BUILD.gn @@ -82,6 +82,7 @@ ohos_shared_library("ark_debugger") { ohos_source_set("ark_debugger_static") { deps = [] + configs = [] defines = [ "BOOST_ERROR_CODE_HEADER_ONLY", "BOOST_CLANG", @@ -113,12 +114,14 @@ ohos_source_set("ark_debugger_static") { "//arkcompiler/ets_runtime", "//arkcompiler/runtime_core", ] + configs += [ sdk_libc_secshared_config ] + public_deps = [ sdk_libc_secshared_dep ] } else { include_dirs += [ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include" ] } - configs = [ + configs += [ ":ark_debugger_config", ":ark_platform_config", ] diff --git a/inspector/log_wrapper.cpp b/inspector/log_wrapper.cpp index 59f663ef70aff65b120dc56f6eccd6fa0c5eefb7..85c4720c232e53d98ba56b41ef4b27fb113e1df1 100644 --- a/inspector/log_wrapper.cpp +++ b/inspector/log_wrapper.cpp @@ -18,6 +18,8 @@ #include #ifdef ANDROID_PLATFORM #include +#elif defined(IOS_PLATFORM) +#include "securec.h" #endif namespace OHOS::ArkCompiler::Toolchain { @@ -54,7 +56,7 @@ void StdLog::PrintLog(LogLevel level, const char* fmt, ...) va_start(args, fmt); char buf[MAX_BUFFER_SIZE]; - if (vsnprintf(buf, sizeof(buf), formatted.c_str(), args) < 0 && errno == EINVAL) { + if (vsnprintf_s(buf, sizeof(buf), sizeof(buf) - 1, formatted.c_str(), args) != EOK && errno == EINVAL) { return; } va_end(args); @@ -83,8 +85,8 @@ void StdLog::PrintLog(LogLevel level, const char* fmt, ...) break; } - if (snprintf(timeBuf, sizeof(timeBuf), "%s", - domainTag, levelTag.c_str(), std::this_thread::get_id()) < 0) { + if (snprintf_s(timeBuf, sizeof(timeBuf), sizeof(timeBuf) - 1, "%s", + domainTag, levelTag.c_str(), std::this_thread::get_id()) != EOK) { return; }