mirror of
https://github.com/openharmony/communication_t2stack.git
synced 2026-07-21 00:35:25 -04:00
fixing the improper use of memcpy_s
Signed-off-by: yexiaokang <yexiaokang3@huawei.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user