mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
udp: Prefer memcpy() over bcopy()
The variable b[] is on the stack, thus cannot overlap with ipov, which
points to the heap area, so prefer memcpy() over memmove(), aka bcopy().
No functional change intended.
Reviewed by: cc, rrs, cy, #transport, #network
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D47713
(cherry picked from commit 949190c5af)
This commit is contained in:
parent
d460330dfe
commit
0b80bf9edb
1 changed files with 2 additions and 2 deletions
|
|
@ -546,12 +546,12 @@ udp_input(struct mbuf **mp, int *offp, int proto)
|
|||
char b[offsetof(struct ipovly, ih_src)];
|
||||
struct ipovly *ipov = (struct ipovly *)ip;
|
||||
|
||||
bcopy(ipov, b, sizeof(b));
|
||||
memcpy(b, ipov, sizeof(b));
|
||||
bzero(ipov, sizeof(ipov->ih_x1));
|
||||
ipov->ih_len = (proto == IPPROTO_UDP) ?
|
||||
uh->uh_ulen : htons(ip_len);
|
||||
uh_sum = in_cksum(m, len + sizeof (struct ip));
|
||||
bcopy(b, ipov, sizeof(b));
|
||||
memcpy(ipov, b, sizeof(b));
|
||||
}
|
||||
if (uh_sum) {
|
||||
UDPSTAT_INC(udps_badsum);
|
||||
|
|
|
|||
Loading…
Reference in a new issue