From owner-svn-src-all@freebsd.org Tue Jun 26 21:56:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 890AB101D056; Tue, 26 Jun 2018 21:56:07 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 37026861A0; Tue, 26 Jun 2018 21:56:07 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 191C01A148; Tue, 26 Jun 2018 21:56:07 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5QLu6dE089522; Tue, 26 Jun 2018 21:56:06 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5QLu6c0089521; Tue, 26 Jun 2018 21:56:06 GMT (envelope-from np@FreeBSD.org) Message-Id: <201806262156.w5QLu6c0089521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 26 Jun 2018 21:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335680 - head/usr.sbin/cxgbetool X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/usr.sbin/cxgbetool X-SVN-Commit-Revision: 335680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2018 21:56:07 -0000 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);