!242 fix:修改安全告警

Merge pull request !242 from 李天刚/master
This commit is contained in:
openharmony_ci
2024-12-19 01:24:05 +00:00
committed by Gitee
2 changed files with 3 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -35,7 +35,7 @@ namespace DistributedInput {
};
const int32_t ENCRYPT_TAG_LEN = 32;
const int32_t MSG_MAX_SIZE = 45 * 1024;
const uint32_t MSG_MAX_SIZE = 45 * 1024;
const uint32_t SESSION_NAME_SIZE_MAX = 256;
const uint32_t DEVICE_ID_SIZE_MAX = 65;
@@ -466,7 +466,7 @@ bool DistributedInputTransportBase::CheckRecivedData(const std::string &message)
void DistributedInputTransportBase::OnBytesReceived(int32_t sessionId, const void *data, uint32_t dataLen)
{
if (sessionId < 0 || data == nullptr || dataLen <= 0) {
if (sessionId < 0 || data == nullptr || dataLen == 0 || dataLen > MSG_MAX_SIZE) {
DHLOGE("OnBytesReceived param check failed");
return;
}