Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Apr 2016 01:35:52 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297477 - head/usr.sbin/mtest
Message-ID:  <201604010135.u311ZqFd027562@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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");



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