From 50232f162c0afb0f272c98302f92341a86cf06d1 Mon Sep 17 00:00:00 2001 From: li-tiangang4 Date: Sat, 28 Dec 2024 09:51:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=8A=E8=AD=A6=E5=9B=9E?= =?UTF-8?q?=E5=90=885.0.1-Release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-tiangang4 --- services/common/include/dinput_softbus_define.h | 4 ++-- .../transportbase/src/distributed_input_transport_base.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/common/include/dinput_softbus_define.h b/services/common/include/dinput_softbus_define.h index 70dd253..e9b1579 100644 --- a/services/common/include/dinput_softbus_define.h +++ b/services/common/include/dinput_softbus_define.h @@ -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; diff --git a/services/transportbase/src/distributed_input_transport_base.cpp b/services/transportbase/src/distributed_input_transport_base.cpp index ad8a335..278ea32 100644 --- a/services/transportbase/src/distributed_input_transport_base.cpp +++ b/services/transportbase/src/distributed_input_transport_base.cpp @@ -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; } -- Gitee