Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jun 2018 21:56:06 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335680 - head/usr.sbin/cxgbetool
Message-ID:  <201806262156.w5QLu6c0089521@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Tue Jun 26 21:56:06 2018
New Revision: 335680
URL: https://svnweb.freebsd.org/changeset/base/335680

Log:
  cxgbetool(8): Reject invalid VLAN values.
  
  Submitted by:	Krishnamraju Eraparaju @ Chelsio
  MFC after:	1 week
  Sponsored by:	Chelsio Communications

Modified:
  head/usr.sbin/cxgbetool/cxgbetool.c

Modified: head/usr.sbin/cxgbetool/cxgbetool.c
==============================================================================
--- head/usr.sbin/cxgbetool/cxgbetool.c	Tue Jun 26 20:26:57 2018	(r335679)
+++ head/usr.sbin/cxgbetool/cxgbetool.c	Tue Jun 26 21:56:06 2018	(r335680)
@@ -1102,6 +1102,8 @@ del_filter(uint32_t idx, int hashfilter)
 	return doit(CHELSIO_T4_DEL_FILTER, &t);
 }
 
+#define MAX_VLANID (4095)
+
 static int
 set_filter(uint32_t idx, int argc, const char *argv[], int hash)
 {
@@ -1308,7 +1310,8 @@ set_filter(uint32_t idx, int argc, const char *argv[],
 			    t.fs.newvlan == VLAN_INSERT) {
 				t.fs.vlan = strtoul(argv[start_arg + 1] + 1,
 				    &p, 0);
-				if (p == argv[start_arg + 1] + 1 || p[0] != 0) {
+				if (p == argv[start_arg + 1] + 1 || p[0] != 0 ||
+				    t.fs.vlan > MAX_VLANID) {
 					warnx("invalid vlan \"%s\"",
 					     argv[start_arg + 1]);
 					return (EINVAL);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806262156.w5QLu6c0089521>