diff --git a/services/implementation/src/dependency/softbus/softbus_session.cpp b/services/implementation/src/dependency/softbus/softbus_session.cpp index 73efad2e5e8ead0a6e74dffd397c6ec526ffbf47..27e393c69b44d3dc2a6a9ef261d7eabbd05df9e3 100644 --- a/services/implementation/src/dependency/softbus/softbus_session.cpp +++ b/services/implementation/src/dependency/softbus/softbus_session.cpp @@ -27,6 +27,7 @@ namespace OHOS { namespace DistributedHardware { std::shared_ptr SoftbusSession::sessionCallback_ = nullptr; constexpr const char* DM_HITRACE_AUTH_TO_OPPEN_SESSION = "DM_HITRACE_AUTH_TO_OPPEN_SESSION"; +constexpr unsigned int DATA_LEN = 65535; static void OnShutdown(int32_t socket, ShutdownReason reason) { @@ -172,8 +173,8 @@ void SoftbusSession::OnSessionClosed(int sessionId) void SoftbusSession::OnBytesReceived(int sessionId, const void *data, unsigned int dataLen) { - if (sessionId < 0 || data == nullptr || dataLen <= 0) { - LOGI("[SOFTBUS]fail to receive data from softbus with sessionId: %{public}d, dataLen: %{public}d.", sessionId, + if (sessionId < 0 || data == nullptr || dataLen <= 0 || dataLen > DATA_LEN) { + LOGI("[SOFTBUS]fail to receive data from softbus with sessionId : %{public}d, dataLen : %{public}d.", sessionId, dataLen); return; }