fixing the improper use of memcpy_s

Signed-off-by: yexiaokang <yexiaokang3@huawei.com>
This commit is contained in:
yexiaokang
2025-09-16 14:28:49 +08:00
committed by Agrant
parent 91f20015a1
commit afb972eeca
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);