Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Jan 2010 22:44:49 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r201540 - stable/8/sys/net
Message-ID:  <201001042244.o04Min7j003269@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Mon Jan  4 22:44:48 2010
New Revision: 201540
URL: http://svn.freebsd.org/changeset/base/201540

Log:
  MFC 201351:
  Use stricter checking to match possible vlan clones by not allowing extra
  garbage characters around or within the tag.

Modified:
  stable/8/sys/net/if_vlan.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/net/if_vlan.c
==============================================================================
--- stable/8/sys/net/if_vlan.c	Mon Jan  4 22:23:09 2010	(r201539)
+++ stable/8/sys/net/if_vlan.c	Mon Jan  4 22:44:48 2010	(r201540)
@@ -577,7 +577,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();
@@ -587,13 +587,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?201001042244.o04Min7j003269>