Date: Thu, 31 Dec 2009 20:44:38 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r201351 - head/sys/net Message-ID: <200912312044.nBVKicMb003815@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Thu Dec 31 20:44:38 2009 New Revision: 201351 URL: http://svn.freebsd.org/changeset/base/201351 Log: Use stricter checking to match possible vlan clones by not allowing extra garbage characters around or within the tag. Reviewed by: brooks MFC after: 3 days Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Thu Dec 31 20:29:58 2009 (r201350) +++ head/sys/net/if_vlan.c Thu Dec 31 20:44:38 2009 (r201351) @@ -582,7 +582,7 @@ vlan_clone_match_ethertag(struct if_clon { const char *cp; struct ifnet *ifp; - int t = 0; + int t; /* Check for <etherif>.<vlan> style interface names. */ IFNET_RLOCK_NOSLEEP(); @@ -592,13 +592,15 @@ vlan_clone_match_ethertag(struct if_clon if (strncmp(ifp->if_xname, name, strlen(ifp->if_xname)) != 0) continue; cp = name + strlen(ifp->if_xname); - if (*cp != '.') + if (*cp++ != '.') continue; - for(; *cp != '\0'; cp++) { - if (*cp < '0' || *cp > '9') - continue; + if (*cp == '\0') + continue; + t = 0; + for(; *cp >= '0' && *cp <= '9'; cp++) t = (t * 10) + (*cp - '0'); - } + if (*cp != '\0') + continue; if (tag != NULL) *tag = t; break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912312044.nBVKicMb003815>