From afb972eeca135824a01ae2e289990a45a53749cc Mon Sep 17 00:00:00 2001 From: yexiaokang Date: Tue, 16 Sep 2025 14:28:49 +0800 Subject: [PATCH] fixing the improper use of memcpy_s Signed-off-by: yexiaokang --- nstackx_ctrl/core/nstackx_dfinder_hidump.c | 2 +- nstackx_ctrl/core/nstackx_smartgenius.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nstackx_ctrl/core/nstackx_dfinder_hidump.c b/nstackx_ctrl/core/nstackx_dfinder_hidump.c index 3455904..76254e9 100644 --- a/nstackx_ctrl/core/nstackx_dfinder_hidump.c +++ b/nstackx_ctrl/core/nstackx_dfinder_hidump.c @@ -231,7 +231,7 @@ int DumpDeviceInfo(const DeviceInfo *info, char *buf, int size, uint8_t remote) if (len > 0) { size_t anonyLen = remote == NSTACKX_TRUE ? DFINDER_DEVICE_ID_ANONY_REMOTE_LEN : DFINDER_DEVICE_ID_ANONY_LEN; len = len > anonyLen ? anonyLen : len; - ret = memcpy_s(deviceid, anonyLen, info->deviceId, len); + ret = memcpy_s(deviceid, sizeof(deviceid), info->deviceId, len); if (ret != EOK) { DFINDER_LOGE(TAG, "memcpy_s failed"); return NSTACKX_EFAILED; diff --git a/nstackx_ctrl/core/nstackx_smartgenius.c b/nstackx_ctrl/core/nstackx_smartgenius.c index fff04db..14360ae 100644 --- a/nstackx_ctrl/core/nstackx_smartgenius.c +++ b/nstackx_ctrl/core/nstackx_smartgenius.c @@ -133,7 +133,7 @@ static void IfAddrMsgHandle(struct nlmsghdr *msgHdr) if (msgHdr->nlmsg_type == RTM_NEWADDR) { if (memcpy_s(&interfaceInfo.ip, sizeof(interfaceInfo.ip), - RTA_DATA(tb[IFA_ADDRESS]), sizeof(interfaceInfo.ip)) != EOK) { + RTA_DATA(tb[IFA_ADDRESS]), sizeof(struct in_addr)) != EOK) { return; } DFINDER_LOGD(TAG, "Interface %s got new address.", interfaceInfo.name);