Security standard alarm processing

Signed-off-by: shiminnan@huawei.com <shiminnan@huawei.com>
This commit is contained in:
swx1282997 2024-05-05 12:20:35 +08:00
parent 5e84199515
commit b627cccd0f
6 changed files with 14 additions and 3 deletions

View File

@ -1854,7 +1854,7 @@ Local<JSValueRef> DebuggerImpl::ConvertToLocal(const std::string &varValue)
taggedValue = JSValueRef::True(vm_);
} else if (varValue == "undefined") {
taggedValue = JSValueRef::Undefined(vm_);
} else if (varValue[0] == '\"' && varValue[varValue.length() - 1] == '\"') {
} else if (!varValue.empty() && varValue[0] == '\"' && varValue[varValue.length() - 1] == '\"') {
// 2 : 2 means length
taggedValue = StringRef::NewFromUtf8(vm_, varValue.substr(1, varValue.length() - 2).c_str());
} else {

View File

@ -73,6 +73,7 @@ bool PtJson::Add(const char *key, bool value) const
return false;
}
cJSON_Delete(node);
return true;
}
@ -106,6 +107,7 @@ bool PtJson::Add(const char *key, double value) const
return false;
}
cJSON_Delete(node);
return true;
}
@ -124,6 +126,7 @@ bool PtJson::Add(const char *key, const char *value) const
return false;
}
cJSON_Delete(node);
return true;
}
@ -157,6 +160,7 @@ bool PtJson::Push(bool value) const
return false;
}
cJSON_Delete(node);
return true;
}
@ -188,6 +192,7 @@ bool PtJson::Push(double value) const
return false;
}
cJSON_Delete(node);
return true;
}
@ -204,6 +209,7 @@ bool PtJson::Push(const char *value) const
return false;
}
cJSON_Delete(node);
return true;
}

View File

@ -118,6 +118,7 @@ void GetInputCommand([[maybe_unused]] void *arg)
if (uv_is_active(reinterpret_cast<uv_handle_t*>(g_releaseHandle))) {
uv_async_send(g_releaseHandle);
}
free(msg);
break;
}
g_inputSignal->data = std::move(msg);

View File

@ -237,7 +237,7 @@ void HeapProfilerClient::RecvReply(std::unique_ptr<PtJson> json)
std::string wholeMethod;
std::string method;
ret = json->GetString("method", &wholeMethod);
if (ret != Result::SUCCESS) {
if (ret != Result::SUCCESS || wholeMethod.empty()) {
LOGE("find method error");
return;
}

View File

@ -55,6 +55,10 @@ void DomainManager::DispatcherReply(char* msg)
std::string wholeMethod;
ret = json->GetString("method", &wholeMethod);
if (wholeMethod.empty()) {
LOGE("find method empty");
return;
}
if (ret == Result::SUCCESS) {
std::string::size_type length = wholeMethod.length();
std::string::size_type indexPoint = 0;

View File

@ -59,7 +59,7 @@ DispatchRequest::DispatchRequest(const std::string &message)
std::string wholeMethod;
ret = json->GetString("method", &wholeMethod);
if (ret != Result::SUCCESS) {
if (ret != Result::SUCCESS || wholeMethod.empty()) {
code_ = RequestCode::PARSE_METHOD_ERROR;
LOG_DEBUGGER(ERROR) << "parse method error";
return;