From owner-svn-src-head@freebsd.org Fri Apr 1 01:35:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40415AE4B65; Fri, 1 Apr 2016 01:35:53 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 0E03B1B9C; Fri, 1 Apr 2016 01:35:52 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u311ZqVU027563; Fri, 1 Apr 2016 01:35:52 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u311ZqFd027562; Fri, 1 Apr 2016 01:35:52 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604010135.u311ZqFd027562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 1 Apr 2016 01:35:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297477 - head/usr.sbin/mtest X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Apr 2016 01:35:53 -0000 Author: pfg Date: Fri Apr 1 01:35:52 2016 New Revision: 297477 URL: https://svnweb.freebsd.org/changeset/base/297477 Log: mtest: Prevent access to uninitialized value. case 'g' makes use of value n, which is initialized for case 'b' and passe through to case 'g'. If case 'g' is called directly value 'n' is not initialized. Avoid the issue by initializing n before entering the switch. CID: 1006375 Reviewed by: bms Modified: head/usr.sbin/mtest/mtest.c Modified: head/usr.sbin/mtest/mtest.c ============================================================================== --- head/usr.sbin/mtest/mtest.c Thu Mar 31 23:57:03 2016 (r297476) +++ head/usr.sbin/mtest/mtest.c Fri Apr 1 01:35:52 2016 (r297477) @@ -396,6 +396,7 @@ process_cmd(char *cmd, int s, int s6, FI while (isblank(*++line)) ; /* Skip whitespace. */ + n = 0; switch (*cmd) { case '?': usage(); @@ -611,7 +612,6 @@ process_cmd(char *cmd, int s, int s6, FI } /* First determine our current filter mode. */ - n = 0; if (getsourcefilter(af2sock(af, s, s6), ifindex, &su.sa, su.sa.sa_len, &fmode, &n, NULL) != 0) { warn("getsourcefilter");