summaryrefslogtreecommitdiffstats
path: root/usr.sbin/route6d
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2003-08-18 16:09:59 +0000
committerume <ume@FreeBSD.org>2003-08-18 16:09:59 +0000
commitd4335be73fc9d10613c8a6db62b08cedc6a03222 (patch)
tree1db03b26770fd9cd62e126093820e0f0fd331d84 /usr.sbin/route6d
parent9772e1f2d88c64e7e86ea7cb8d1f2d1c561197b5 (diff)
downloadFreeBSD-src-d4335be73fc9d10613c8a6db62b08cedc6a03222.zip
FreeBSD-src-d4335be73fc9d10613c8a6db62b08cedc6a03222.tar.gz
atoi -> strtoul
Obtained from: KAME MFC after: 1 week
Diffstat (limited to 'usr.sbin/route6d')
-rw-r--r--usr.sbin/route6d/route6d.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index 9a2507b..0229770 100644
--- a/usr.sbin/route6d/route6d.c
+++ b/usr.sbin/route6d/route6d.c
@@ -3049,13 +3049,14 @@ void
filterconfig()
{
int i;
- char *p, *ap, *iflp, *ifname;
+ char *p, *ap, *iflp, *ifname, *ep;
struct iff ftmp, *iff_obj;
struct ifc *ifcp;
struct riprt *rrt;
#if 0
struct in6_addr gw;
#endif
+ u_long plen;
for (i = 0; i < nfilter; i++) {
ap = filter[i];
@@ -3078,7 +3079,14 @@ filterconfig()
fatal("invalid prefix specified for '%s'", ap);
/*NOTREACHED*/
}
- ftmp.iff_plen = atoi(p);
+ errno = 0;
+ ep = NULL;
+ plen = strtoul(p, &ep, 10);
+ if (errno || !*p || *ep || plen > sizeof(ftmp.iff_addr) * 8) {
+ fatal("invalid prefix length specified for '%s'", ap);
+ /*NOTREACHED*/
+ }
+ ftmp.iff_plen = plen;
ftmp.iff_next = NULL;
applyplen(&ftmp.iff_addr, ftmp.iff_plen);
ifonly:
OpenPOWER on IntegriCloud