Hello -

Two bcopy->memmove conversions where src and dst are in the same memory
space.  Perhaps not overlapping, but just being safe.

Convert the bcopy's in tcp_respond to memcpy since the destination is a
new mbuf header.

OK?

Index: netinet/ip_ah.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_ah.c,v
retrieving revision 1.138
diff -u -p -r1.138 ip_ah.c
--- netinet/ip_ah.c     14 Mar 2018 22:38:46 -0000      1.138
+++ netinet/ip_ah.c     9 Apr 2018 17:48:20 -0000
@@ -899,8 +899,8 @@ ah_input_cb(struct cryptop *crp)
                         * mbuf...do an overlapping copy of the
                         * remainder of the mbuf over the ESP header.
                         */
-                       bcopy(mtod(m1, u_char *) + roff + rplen +
-                           ahx->authsize, mtod(m1, u_char *) + roff,
+                       memmove(mtod(m1, u_char *) + roff,
+                           mtod(m1, u_char *) + roff + rplen + ahx->authsize,
                            m1->m_len - (roff + rplen + ahx->authsize));
                        m1->m_len -= rplen + ahx->authsize;
                        m->m_pkthdr.len -= rplen + ahx->authsize;
Index: netinet/tcp_subr.c
===================================================================
RCS file: /cvs/src/sys/netinet/tcp_subr.c,v
retrieving revision 1.170
diff -u -p -r1.170 tcp_subr.c
--- netinet/tcp_subr.c  2 Apr 2018 14:19:17 -0000       1.170
+++ netinet/tcp_subr.c  9 Apr 2018 17:48:20 -0000
@@ -328,11 +328,11 @@ tcp_respond(struct tcpcb *tp, caddr_t te
                th = (struct tcphdr *)(ip6 + 1);
                tlen = sizeof(*ip6) + sizeof(*th);
                if (th0) {
-                       bcopy(template, ip6, sizeof(*ip6));
-                       bcopy(th0, th, sizeof(*th));
+                       memcpy(ip6, template, sizeof(*ip6));
+                       memcpy(th, th0, sizeof(*th));
                        xchg(ip6->ip6_dst, ip6->ip6_src, struct in6_addr);
                } else {
-                       bcopy(template, ip6, tlen);
+                       memcpy(ip6, template, tlen);
                }
                break;
 #endif /* INET6 */
@@ -341,11 +341,11 @@ tcp_respond(struct tcpcb *tp, caddr_t te
                th = (struct tcphdr *)(ip + 1);
                tlen = sizeof(*ip) + sizeof(*th);
                if (th0) {
-                       bcopy(template, ip, sizeof(*ip));
-                       bcopy(th0, th, sizeof(*th));
+                       memcpy(ip, template, sizeof(*ip));
+                       memcpy(th, th0, sizeof(*th));
                        xchg(ip->ip_dst.s_addr, ip->ip_src.s_addr, u_int32_t);
                } else {
-                       bcopy(template, ip, tlen);
+                       memcpy(ip, template, tlen);
                }
                break;
        }
Index: netinet/udp_usrreq.c
===================================================================
RCS file: /cvs/src/sys/netinet/udp_usrreq.c,v
retrieving revision 1.246
diff -u -p -r1.246 udp_usrreq.c
--- netinet/udp_usrreq.c        6 Apr 2018 10:59:11 -0000       1.246
+++ netinet/udp_usrreq.c        9 Apr 2018 17:48:20 -0000
@@ -295,8 +295,8 @@ udp_input(struct mbuf **mp, int *offp, i
                        }
 
                        /* remove the UDP header */
-                       bcopy(mtod(m, u_char *),
-                           mtod(m, u_char *) + sizeof(struct udphdr), iphlen);
+                       memmove(mtod(m, u_char *) + sizeof(struct udphdr),
+                           mtod(m, u_char *), iphlen);
                        m_adj(m, sizeof(struct udphdr));
                        skip -= sizeof(struct udphdr);
 

Reply via email to