diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-05-03 21:16:31 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-05-03 21:16:31 +0000 |
commit | 725acc4414e36b669a77770a786b7f9490eff3a3 (patch) | |
tree | 5413c025cb9c943e75923103c2fc48bfbd4414b4 /sys | |
parent | 492edca4204c3a1bbefa82cd0298b4bc5044d58c (diff) |
string fixes; tedu ok
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_icmp.c | 9 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 8 | ||||
-rw-r--r-- | sys/netipx/ipx_ip.c | 6 | ||||
-rw-r--r-- | sys/netns/ns_ip.c | 14 |
4 files changed, 22 insertions, 15 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index bd675f1015d..23df448f5c6 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.57 2003/02/12 14:41:07 jason Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.58 2003/05/03 21:16:30 deraadt Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -324,7 +324,7 @@ icmp_input(struct mbuf *m, ...) if (icmpprintfs) { char buf[4 * sizeof("123")]; - strcpy(buf, inet_ntoa(ip->ip_dst)); + strlcpy(buf, inet_ntoa(ip->ip_dst), sizeof buf); printf("icmp_input from %s to %s, len %d\n", inet_ntoa(ip->ip_src), buf, icmplen); } @@ -560,7 +560,8 @@ reflect: #ifdef ICMPPRINTFS if (icmpprintfs) { char buf[4 * sizeof("123")]; - strcpy(buf, inet_ntoa(icp->icmp_ip.ip_dst)); + strlcpy(buf, inet_ntoa(icp->icmp_ip.ip_dst), + sizeof buf); printf("redirect dst %s to %s\n", buf, inet_ntoa(icp->icmp_gwaddr)); @@ -779,7 +780,7 @@ icmp_send(struct mbuf *m, struct mbuf *opts) if (icmpprintfs) { char buf[4 * sizeof("123")]; - strcpy(buf, inet_ntoa(ip->ip_dst)); + strlcpy(buf, inet_ntoa(ip->ip_dst), sizeof buf); printf("icmp_send dst %s src %s\n", buf, inet_ntoa(ip->ip_src)); } diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index cee5710847a..1477d1b046d 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.110 2003/02/12 14:41:07 jason Exp $ */ +/* $OpenBSD: ip_input.c,v 1.111 2003/05/03 21:16:30 deraadt Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -193,7 +193,8 @@ inet_ntoa(ina) static char buf[4*sizeof "123"]; unsigned char *ucp = (unsigned char *)&ina; - sprintf(buf, "%d.%d.%d.%d", ucp[0] & 0xff, ucp[1] & 0xff, + snprintf(buf, sizeof buf, "%d.%d.%d.%d", + ucp[0] & 0xff, ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff); return (buf); } @@ -1040,7 +1041,8 @@ ip_dooptions(m) if (!ip_dosourceroute) { char buf[4*sizeof "123"]; - strcpy(buf, inet_ntoa(ip->ip_dst)); + strlcpy(buf, inet_ntoa(ip->ip_dst), + sizeof buf); log(LOG_WARNING, "attempted source route from %s to %s\n", inet_ntoa(ip->ip_src), buf); diff --git a/sys/netipx/ipx_ip.c b/sys/netipx/ipx_ip.c index 436667d39ea..332cd4945b3 100644 --- a/sys/netipx/ipx_ip.c +++ b/sys/netipx/ipx_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipx_ip.c,v 1.13 2002/09/18 07:46:56 mickey Exp $ */ +/* $OpenBSD: ipx_ip.c,v 1.14 2003/05/03 21:16:30 deraadt Exp $ */ /*- * @@ -94,7 +94,7 @@ ipxipattach(void) if (ipxipif.if_mtu == 0) { ifp = &ipxipif; - sprintf(ifp->if_xname, "ipx0"); + snprintf(ifp->if_xname, sizeof ifp->if_xname, "ipx0"); ifp->if_mtu = LOMTU; ifp->if_ioctl = ipxipioctl; ifp->if_output = ipxipoutput; @@ -111,7 +111,7 @@ ipxipattach(void) ipxip_list = m; ifp = &m->ifen_ifnet; - sprintf(ifp->if_xname, "ipx0"); + snprintf(ifp->if_xname, sizeof ifp->if_xname, "ipx0"); ifp->if_mtu = LOMTU; ifp->if_ioctl = ipxipioctl; ifp->if_output = ipxipoutput; diff --git a/sys/netns/ns_ip.c b/sys/netns/ns_ip.c index a8b70e1f598..dcbc7a8c192 100644 --- a/sys/netns/ns_ip.c +++ b/sys/netns/ns_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ns_ip.c,v 1.15 2002/08/28 15:43:03 pefo Exp $ */ +/* $OpenBSD: ns_ip.c,v 1.16 2003/05/03 21:16:30 deraadt Exp $ */ /* $NetBSD: ns_ip.c,v 1.16 1996/05/09 22:29:40 scottr Exp $ */ /* @@ -93,7 +93,8 @@ nsipattach() if (nsipif.if_mtu == 0) { ifp = &nsipif; - sprintf(ifp->if_xname, "nsip%d", nsipif_unit); + snprintf(ifp->if_xname, sizeof ifp->if_xname, + "nsip%d", nsipif_unit); ifp->if_mtu = LOMTU; ifp->if_ioctl = nsipioctl; ifp->if_output = nsipoutput; @@ -107,7 +108,8 @@ nsipattach() nsip_list = m; ifp = &m->ifen_ifnet; - sprintf(ifp->if_xname, "nsip%d", nsipif_unit++); + snprintf(ifp->if_xname, sizeof ifp->if_xname, + "nsip%d", nsipif_unit++); ifp->if_mtu = LOMTU; ifp->if_ioctl = nsipioctl; ifp->if_output = nsipoutput; @@ -120,7 +122,8 @@ nsipattach() * XXX in the days before if_xname. */ bzero(nsipif.if_xname, sizeof(nsipif.if_xname)); - sprintf(nsipif.if_xname, "nsip%d", nsipif_unit); + snprintf(nsipif.if_xname, sizeof nsipif.if_xname, + "nsip%d", nsipif_unit); return (m); } @@ -395,7 +398,8 @@ nsip_route(m) * now configure this as a point to point link */ bzero(ifr.ifr_name, sizeof(ifr.ifr_name)); - sprintf(ifr.ifr_name, "nsip%d", nsipif_unit - 1); + snprintf(ifr.ifr_name, sizeof ifr.ifr_name, + "nsip%d", nsipif_unit - 1); ifr.ifr_dstaddr = *snstosa(ns_dst); (void)ns_control((struct socket *)0, SIOCSIFDSTADDR, (caddr_t)&ifr, (struct ifnet *)ifn); |