diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-11-29 16:49:10 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-11-29 16:49:10 +0000 |
commit | 7dc4e7380bb25bb6221310ae69f4dcfa04ac891b (patch) | |
tree | 4c2d34b44c1bdadf7ea803fcf83d930135ef1e61 | |
parent | 0f593d10d604bdd9ce3c8f3aae3269574f4a2406 (diff) |
Replace strncpy() calls with adequate strlcpy() ones, and fix a cosmeto.
jason@ ok
-rw-r--r-- | usr.sbin/pppoe/pppoe.c | 11 | ||||
-rw-r--r-- | usr.sbin/pppoe/server.c | 5 |
2 files changed, 6 insertions, 10 deletions
diff --git a/usr.sbin/pppoe/pppoe.c b/usr.sbin/pppoe/pppoe.c index 015346f2d73..c0de4db6707 100644 --- a/usr.sbin/pppoe/pppoe.c +++ b/usr.sbin/pppoe/pppoe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pppoe.c,v 1.4 2001/04/15 20:41:46 jason Exp $ */ +/* $OpenBSD: pppoe.c,v 1.5 2001/11/29 16:49:09 miod Exp $ */ /* * Copyright (c) 2000 Network Security Technologies, Inc. http://www.netsec.net @@ -275,8 +275,7 @@ setupfilter(ifn, ea, server_mode) err(EX_IOERR, "set immediate"); } - strncpy(ifr.ifr_name, ifn, sizeof(ifr.ifr_name)); - ifr.ifr_name[sizeof(ifr.ifr_name)-1] = '\0'; + strlcpy(ifr.ifr_name, ifn, sizeof(ifr.ifr_name)); if (ioctl(fd, BIOCSETIF, &ifr) < 0) { close(fd); err(EX_IOERR, "set interface"); @@ -340,8 +339,7 @@ getifhwaddr(ifnhint, ifnambuf, ea) sizeof(ifrp->ifr_name))) continue; if (ifnhint == NULL) { - strncpy(req.ifr_name, ifrp->ifr_name, IFNAMSIZ); - req.ifr_name[IFNAMSIZ-1] = '\0'; + strlcpy(req.ifr_name, ifrp->ifr_name, sizeof(req.ifr_name)); if (ioctl(s, SIOCGIFFLAGS, &req) < 0) err(EX_IOERR, "get flags"); if ((req.ifr_flags & IFF_UP) == 0) @@ -365,8 +363,7 @@ getifhwaddr(ifnhint, ifnambuf, ea) return (-1); } bcopy(dl->sdl_data + dl->sdl_nlen, ea, sizeof(*ea)); - strncpy(ifnambuf, ifrp->ifr_name, IFNAMSIZ); - ifnambuf[IFNAMSIZ-1] = '\0'; + strlcpy(ifnambuf, ifrp->ifr_name, sizeof(ifnambuf)); free(inbuf); close(s); return (0); diff --git a/usr.sbin/pppoe/server.c b/usr.sbin/pppoe/server.c index e6c76348440..1c61b1e7274 100644 --- a/usr.sbin/pppoe/server.c +++ b/usr.sbin/pppoe/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.4 2001/01/16 05:34:15 jason Exp $ */ +/* $OpenBSD: server.c,v 1.5 2001/11/29 16:49:09 miod Exp $ */ /* * Copyright (c) 2000 Network Security Technologies, Inc. http://www.netsec.net @@ -92,7 +92,6 @@ server_mode(bpffd, sysname, srvname, ea) key_gen(); while (1) { -reselect: n = bpffd; LIST_FOREACH(ses, &session_master.sm_sessions, s_next) { if (ses->s_fd != -1 && ses->s_fd > n) @@ -120,7 +119,7 @@ reselect: n = select(n, fdsp, NULL, NULL, NULL); if (n < 0) { if (errno == EINTR) - goto reselect; + continue; err(EX_IOERR, "select"); break; } |