diff options
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 8 | ||||
-rw-r--r-- | sys/net/if_atmsubr.c | 6 | ||||
-rw-r--r-- | sys/net/if_mib.c | 5 | ||||
-rw-r--r-- | sys/net/if_spppsubr.c | 12 | ||||
-rw-r--r-- | sys/net/if_vlan.c | 6 |
5 files changed, 21 insertions, 16 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 295ae4d..0ac5738 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if.c 8.3 (Berkeley) 1/4/94 - * $Id: if.c,v 1.61 1998/07/20 13:21:56 dfr Exp $ + * $Id: if.c,v 1.62 1998/08/12 22:51:59 wpaul Exp $ */ #include "opt_compat.h" @@ -143,7 +143,8 @@ if_attach(ifp) /* * create a Link Level name for this device */ - namelen = sprintf(workbuf, "%s%d", ifp->if_name, ifp->if_unit); + namelen = snprintf(workbuf, sizeof(workbuf), + "%s%d", ifp->if_name, ifp->if_unit); #define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m)) masklen = _offsetof(struct sockaddr_dl, sdl_data[0]) + namelen; socksize = masklen + ifp->if_addrlen; @@ -792,7 +793,8 @@ ifconf(cmd, data) char workbuf[64]; int ifnlen; - ifnlen = sprintf(workbuf, "%s%d", ifp->if_name, ifp->if_unit); + ifnlen = snprintf(workbuf, sizeof(workbuf), + "%s%d", ifp->if_name, ifp->if_unit); if(ifnlen + 1 > sizeof ifr.ifr_name) { error = ENAMETOOLONG; } else { diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c index a41bfaf..9f56a9b 100644 --- a/sys/net/if_atmsubr.c +++ b/sys/net/if_atmsubr.c @@ -521,14 +521,16 @@ pvc_ioctl(shadow, cmd, data) */ switch (cmd) { case SIOCGPVCSIF: - sprintf(ifr->ifr_name, "%s%d", ifp->if_name, ifp->if_unit); + snprintf(ifr->ifr_name, sizeof(ifr->ifr_name), + "%s%d", ifp->if_name, ifp->if_unit); return (0); case SIOCGPVCTX: do { struct pvctxreq *pvcreq = (struct pvctxreq *)data; - sprintf(pvcreq->pvc_ifname, "%s%d", + snprintf(pvcreq->pvc_ifname, + sizeof(pvcreq->pvc_ifname), "%s%d", ifp->if_name, ifp->if_unit); pvcreq->pvc_aph = pvcsif->sif_aph; } while (0); diff --git a/sys/net/if_mib.c b/sys/net/if_mib.c index 268669d..2e8f331 100644 --- a/sys/net/if_mib.c +++ b/sys/net/if_mib.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_mib.c,v 1.4 1997/02/22 09:41:02 peter Exp $ + * $Id: if_mib.c,v 1.5 1997/08/02 14:32:38 bde Exp $ */ #include <sys/param.h> @@ -89,7 +89,8 @@ sysctl_ifdata SYSCTL_HANDLER_ARGS /* XXX bad syntax! */ return ENOENT; case IFDATA_GENERAL: - ifnlen = sprintf(workbuf, "%s%d", ifp->if_name, ifp->if_unit); + ifnlen = snprintf(workbuf, sizeof(workbuf), + "%s%d", ifp->if_name, ifp->if_unit); if(ifnlen + 1 > sizeof ifmd.ifmd_name) { return ENAMETOOLONG; } else { diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index e5b040d..aeb9550 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -17,7 +17,7 @@ * * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997 * - * $Id: if_spppsubr.c,v 1.44 1998/10/06 20:47:53 joerg Exp $ + * $Id: if_spppsubr.c,v 1.45 1998/10/06 21:12:45 joerg Exp $ */ #include <sys/param.h> @@ -4029,7 +4029,7 @@ sppp_cp_type_name(u_char type) case ECHO_REPLY: return "echo-reply"; case DISC_REQ: return "discard-req"; } - sprintf (buf, "0x%x", type); + snprintf (buf, sizeof(buf), "0x%x", type); return buf; } @@ -4052,7 +4052,7 @@ sppp_auth_type_name(u_short proto, u_char type) case PAP_NAK: return "nak"; } } - sprintf (buf, "0x%x", type); + snprintf (buf, sizeof(buf), "0x%x", type); return buf; } @@ -4069,7 +4069,7 @@ sppp_lcp_opt_name(u_char opt) case LCP_OPT_PROTO_COMP: return "proto-comp"; case LCP_OPT_ADDR_COMP: return "addr-comp"; } - sprintf (buf, "0x%x", opt); + snprintf (buf, sizeof(buf), "0x%x", opt); return buf; } @@ -4082,7 +4082,7 @@ sppp_ipcp_opt_name(u_char opt) case IPCP_OPT_COMPRESSION: return "compression"; case IPCP_OPT_ADDRESS: return "address"; } - sprintf (buf, "0x%x", opt); + snprintf (buf, sizeof(buf), "0x%x", opt); return buf; } @@ -4127,7 +4127,7 @@ sppp_proto_name(u_short proto) case PPP_PAP: return "pap"; case PPP_CHAP: return "chap"; } - sprintf(buf, "0x%x", (unsigned)proto); + snprintf(buf, sizeof(buf), "0x%x", (unsigned)proto); return buf; } diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index d6149e9..2488b31 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_vlan.c,v 1.2 1998/05/15 20:02:47 wollman Exp $ + * $Id: if_vlan.c,v 1.3 1998/08/23 03:07:10 wollman Exp $ */ /* @@ -334,8 +334,8 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCGETVLAN: bzero(&vlr, sizeof vlr); if (ifv->ifv_p) { - sprintf(vlr.vlr_parent, "%s%d", ifv->ifv_p->if_name, - ifv->ifv_p->if_unit); + snprintf(vlr.vlr_parent, sizeof(vlr.vlr_parent), + "%s%d", ifv->ifv_p->if_name, ifv->ifv_p->if_unit); vlr.vlr_tag = ifv->ifv_tag; } error = copyout(&vlr, ifr->ifr_data, sizeof vlr); |