diff options
author | gnn <gnn@FreeBSD.org> | 2005-05-15 02:28:30 +0000 |
---|---|---|
committer | gnn <gnn@FreeBSD.org> | 2005-05-15 02:28:30 +0000 |
commit | c853caca3e5fddae2276561f74356a4ec54783e0 (patch) | |
tree | 0bf3963d121c2edbe8546d00ad1b734f627e3ec4 | |
parent | 73f56fbd1534693ebd2437de00078408de2b3851 (diff) | |
download | FreeBSD-src-c853caca3e5fddae2276561f74356a4ec54783e0.zip FreeBSD-src-c853caca3e5fddae2276561f74356a4ec54783e0.tar.gz |
Fixes for various nits found by the Coverity tool.
In particular 2 missed return values and an inappropriate bcopy from
a possibly NULL pointer.
Reviewed by: jake
Approved by: rwatson
MFC after: 1 week
-rw-r--r-- | sys/netinet6/icmp6.c | 7 | ||||
-rw-r--r-- | sys/netinet6/in6_src.c | 2 | ||||
-rw-r--r-- | sys/netinet6/ip6_fw.c | 2 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 2 |
4 files changed, 8 insertions, 5 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 5ab4203..3f3cbd6 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -2092,13 +2092,16 @@ icmp6_reflect(m, off) sa6_src.sin6_len = sizeof(sa6_src); sa6_src.sin6_addr = ip6->ip6_dst; in6_recoverscope(&sa6_src, &ip6->ip6_dst, m->m_pkthdr.rcvif); - in6_embedscope(&ip6->ip6_dst, &sa6_src, NULL, NULL); + if (in6_embedscope(&ip6->ip6_dst, &sa6_src, NULL, NULL)) + goto bad; + bzero(&sa6_dst, sizeof(sa6_dst)); sa6_dst.sin6_family = AF_INET6; sa6_dst.sin6_len = sizeof(sa6_dst); sa6_dst.sin6_addr = t; in6_recoverscope(&sa6_dst, &t, m->m_pkthdr.rcvif); - in6_embedscope(&t, &sa6_dst, NULL, NULL); + if (in6_embedscope(&t, &sa6_dst, NULL, NULL)) + goto bad; #ifdef COMPAT_RFC1885 /* diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index a969d91..812b03d 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -667,7 +667,7 @@ in6_selectroute(dstsock, opts, mopts, ro, retifp, retrt, clone) * (this may happen when we are sending a packet to one of * our own addresses.) */ - if (opts && opts->ip6po_pktinfo && + if (ifp && opts && opts->ip6po_pktinfo && opts->ip6po_pktinfo->ipi6_ifindex) { if (!(ifp->if_flags & IFF_LOOPBACK) && ifp->if_index != diff --git a/sys/netinet6/ip6_fw.c b/sys/netinet6/ip6_fw.c index a399b8b..30a176a 100644 --- a/sys/netinet6/ip6_fw.c +++ b/sys/netinet6/ip6_fw.c @@ -769,7 +769,7 @@ got_match: * - The packet is not an ICMP packet, or is an ICMP query packet * - The packet is not a multicast or broadcast packet */ - if ((rule->fw_flg & IPV6_FW_F_COMMAND) == IPV6_FW_F_REJECT + if (rule && (rule->fw_flg & IPV6_FW_F_COMMAND) == IPV6_FW_F_REJECT && (nxt != IPPROTO_ICMPV6 || is_icmp6_query(ip6, off)) && !((*m)->m_flags & (M_BCAST|M_MCAST)) && !IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 36cfb28..265bd9e 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -2603,7 +2603,7 @@ ip6_copypktopts(src, canwait) if (src->ip6po_nexthop) { dst->ip6po_nexthop = malloc(src->ip6po_nexthop->sa_len, M_IP6OPT, canwait); - if (dst->ip6po_nexthop == NULL && canwait == M_NOWAIT) + if (dst->ip6po_nexthop == NULL) goto bad; bcopy(src->ip6po_nexthop, dst->ip6po_nexthop, src->ip6po_nexthop->sa_len); |