svn commit: r299921 - head/sbin/ifconfig

Don Lewis truckman at FreeBSD.org
Mon May 16 08:07:33 UTC 2016


Author: truckman
Date: Mon May 16 08:07:32 2016
New Revision: 299921
URL: https://svnweb.freebsd.org/changeset/base/299921

Log:
  Add an assertion to catch a potential underflow in an array index
  calculation, though this should not happen in the current code.
  
  Reported by:	Coverity
  CID:		1008486
  MFC after:	3 weeks

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==============================================================================
--- head/sbin/ifconfig/ifieee80211.c	Mon May 16 08:04:40 2016	(r299920)
+++ head/sbin/ifconfig/ifieee80211.c	Mon May 16 08:07:32 2016	(r299921)
@@ -3753,6 +3753,7 @@ list_txpow(int s)
 		/* suppress duplicates as above */
 		if (isset(reported, c->ic_ieee) && !verbose) {
 			/* XXX we assume duplicates are adjacent */
+			assert(achans->ic_nchans > 0);
 			prev = &achans->ic_chans[achans->ic_nchans-1];
 			/* display highest power on channel */
 			if (c->ic_maxpower > prev->ic_maxpower)


More information about the svn-src-all mailing list