diff --git a/baselib/msglib/src/standard/messenger_device_status_manager.cpp b/baselib/msglib/src/standard/messenger_device_status_manager.cpp index 955f9ca2561e517390bdcbab6933df33d87ce7ff..381db29e00297400d0b90085d90fbf361c8f98ad 100644 --- a/baselib/msglib/src/standard/messenger_device_status_manager.cpp +++ b/baselib/msglib/src/standard/messenger_device_status_manager.cpp @@ -79,6 +79,13 @@ public: EVENT_NODE_STATE_OFFLINE = 0, EVENT_NODE_STATE_ONLINE = 1, }; + + struct QueueStatusData { + DeviceIdentify srcIdentity {0, {0}}; + uint32_t status {0}; + uint32_t devType {0}; + }; + DslmDeviceState() = default; ~DslmDeviceState() override = default; @@ -126,11 +133,7 @@ public: SECURITY_LOG_ERROR("ProcessDeviceStatusReceiver, invalid queue"); return; } - struct QueueStatusData { - DeviceIdentify srcIdentity {0, {0}}; - uint32_t status {0}; - uint32_t devType {0}; - }; + QueueStatusData *data = new (std::nothrow) QueueStatusData; if (data == nullptr) { SECURITY_LOG_ERROR("ProcessDeviceStatusReceiver, malloc result null"); diff --git a/baselib/utils/src/utils_mem.c b/baselib/utils/src/utils_mem.c index f9f5e6e18d440f1541b7ed038da36f626ed1572e..e4bf8088b1d83c7ec88525e81b648b9316ff586a 100644 --- a/baselib/utils/src/utils_mem.c +++ b/baselib/utils/src/utils_mem.c @@ -21,9 +21,14 @@ #ifdef __cplusplus extern "C" { #endif +#define MAX_MALLOC_SIZE (64 * 1024) void *UtilsMalloc(size_t size) { + if (size > MAX_MALLOC_SIZE) { + return NULL; + } + return malloc(size); } diff --git a/interfaces/inner_api/src/lite/small/device_security_level_proxy.c b/interfaces/inner_api/src/lite/small/device_security_level_proxy.c index f50cfc1cd0dffc7bc629435d60ad610cbd73ff07..d05e518c11eb02e66fe2e12d5d28aa059549d6a5 100644 --- a/interfaces/inner_api/src/lite/small/device_security_level_proxy.c +++ b/interfaces/inner_api/src/lite/small/device_security_level_proxy.c @@ -34,11 +34,13 @@ static inline Mutex *GetMutex(void) static int DslmIpcCallback(IOwner owner, int code, IpcIo *reply) { + uint32_t result = ERR_DEFAULT; + uint32_t level = 0; + if (owner == NULL) { return ERR_INVALID_PARA; } - uint32_t result, level; struct DslmCallbackHolder *holder = (struct DslmCallbackHolder *)owner; ReadUint32(reply, &result);