diff options
author | wollman <wollman@FreeBSD.org> | 1996-06-05 17:12:41 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1996-06-05 17:12:41 +0000 |
commit | b5c184c463875356ba7397a0697c0d6846a17f02 (patch) | |
tree | 13c3c4997726b168541d36a29933ab48587bbf29 /sys/net | |
parent | 63dc6bde0f5c1d7fba259a7287ef49d65338a72d (diff) | |
download | FreeBSD-src-b5c184c463875356ba7397a0697c0d6846a17f02.zip FreeBSD-src-b5c184c463875356ba7397a0697c0d6846a17f02.tar.gz |
Don't allow trailing garbage after the unit number in ifunit().
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index e8ef47f..5d67e49 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.28 1996/02/08 21:34:56 wollman Exp $ + * $Id: if.c,v 1.29 1996/03/11 15:13:00 davidg Exp $ */ #include <sys/param.h> @@ -452,6 +452,8 @@ ifunit(name) ep = cp; for (unit = 0; *cp >= '0' && *cp <= '9'; ) unit = unit * 10 + *cp++ - '0'; + if (*cp != '\0') + return 0; /* no trailing garbage allowed */ *ep = 0; for (ifp = ifnet; ifp; ifp = ifp->if_next) { if (bcmp(ifp->if_name, name, len)) |