fix code review

Signed-off-by: zhanghaibo <zhanghaibo0@huawei.com>
This commit is contained in:
zhanghaibo
2021-12-30 01:01:53 +08:00
parent 85280a1130
commit 68737dfb1d
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -195,7 +195,7 @@ bool NativeModuleManager::GetNativeModulePath(
return false;
}
} else {
if (sprintf_s(nativeModulePath[0], pathLength, "%s/lib%s",
if (sprintf_s(nativeModulePath[0], pathLength, "%s/lib%s%s",
prefix, dupModuleName, soPostfix) == -1) {
return false;
}
+1 -1
View File
@@ -567,7 +567,7 @@ ExceptionInfo* ArkNativeEngine::GetExceptionForWorker() const
ExceptionInfo* exceptionInfo = new ExceptionInfo();
int msgLength = exceptionStr_.length();
char* exceptionMessage = new char[msgLength + 1] { 0 };
if (memcpy_s(exceptionMessage, msgLength, exceptionStr_.c_str(), msgLength) != EOK) {
if (memcpy_s(exceptionMessage, msgLength + 1, exceptionStr_.c_str(), msgLength) != EOK) {
HILOG_ERROR("worker:: memcpy_s error");
delete exceptionInfo;
delete[] exceptionMessage;
+2 -2
View File
@@ -62,8 +62,8 @@ static void PrintLog(const char* fmt, ...)
va_list args;
va_start(args, fmt);
char buf[MAX_BUFFER_SIZE] = { "\0" };
int ret = vsnprintf(buf, sizeof(buf) - 1, newFmt.c_str(), args);
char buf[MAX_BUFFER_SIZE] = { '\0' };
int ret = vsnprintf_s(buf, sizeof(buf), sizeof(buf) - 1, newFmt.c_str(), args);
if (ret < 0) {
return;
}