mirror of
https://github.com/espressif/openthread.git
synced 2026-08-09 12:17:47 +00:00
[posix] fix memcpy compiler warning false positive (#6840)
In the issue, compiler complained we were copying 16 bytes to a location of 12 bytes. This was because in the check, the compiler thought we are going to copy data to a nlmsghdr which is 12 bytes. The reality is that we're copying data to a place behind nlmsghdr in req struct.
This commit is contained in:
@@ -578,7 +578,7 @@ static otError AddExternalRoute(const otIp6Prefix &aPrefix)
|
||||
|
||||
otIp6AddressToString(&aPrefix.mPrefix, addrBuf, OT_IP6_ADDRESS_STRING_SIZE);
|
||||
inet_pton(AF_INET6, addrBuf, data);
|
||||
AddRtAttr(&req.header, sizeof(req), RTA_DST, data, sizeof(data));
|
||||
AddRtAttr(reinterpret_cast<nlmsghdr *>(&req), sizeof(req), RTA_DST, data, sizeof(data));
|
||||
AddRtAttrUint32(&req.header, sizeof(req), RTA_PRIORITY, kExternalRoutePriority);
|
||||
AddRtAttrUint32(&req.header, sizeof(req), RTA_OIF, netifIdx);
|
||||
|
||||
@@ -627,7 +627,7 @@ static otError DeleteExternalRoute(const otIp6Prefix &aPrefix)
|
||||
|
||||
otIp6AddressToString(&aPrefix.mPrefix, addrBuf, OT_IP6_ADDRESS_STRING_SIZE);
|
||||
inet_pton(AF_INET6, addrBuf, data);
|
||||
AddRtAttr(&req.header, sizeof(req), RTA_DST, data, sizeof(data));
|
||||
AddRtAttr(reinterpret_cast<nlmsghdr *>(&req), sizeof(req), RTA_DST, data, sizeof(data));
|
||||
AddRtAttrUint32(&req.header, sizeof(req), RTA_OIF, netifIdx);
|
||||
|
||||
if (send(sNetlinkFd, &req, sizeof(req), 0) < 0)
|
||||
|
||||
Reference in New Issue
Block a user