Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Feb 2017 20:49:17 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r314181 - head/sbin/ifconfig
Message-ID:  <201702232049.v1NKnHWQ057888@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu Feb 23 20:49:17 2017
New Revision: 314181
URL: https://svnweb.freebsd.org/changeset/base/314181

Log:
  [ifconfig] handle illegal WPS frames
  
  Some APs broadcast WPS IE frames with totally broken data.  Ifconfig's printwpsie()
  loops through WPS frames printing the attributes out; if the frame's data is bad,
  printwpsie() can end up looking at out-of-bounds addresses causing ifconfig to
  bus error.
  
  Thanks to Takashi Inoue at Nihon U for his efforts in debugging this.
  
  PR:		bin/217312
  Submitted by:	fbsd@opal.com
  MFC after:	1 week

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==============================================================================
--- head/sbin/ifconfig/ifieee80211.c	Thu Feb 23 20:41:55 2017	(r314180)
+++ head/sbin/ifconfig/ifieee80211.c	Thu Feb 23 20:49:17 2017	(r314181)
@@ -3160,6 +3160,14 @@ printwpsie(const char *tag, const u_int8
 			uint16_t tlv_type = BE_READ_2(ie);
 			uint16_t tlv_len  = BE_READ_2(ie + 2);
 
+			/* some devices broadcast invalid WPS frames */
+			if (tlv_len > len) {
+				printf("bad frame length tlv_type=0x%02x "
+				    "tlv_len=%d len=%d", tlv_type, tlv_len,
+				    len);
+				break;
+			}
+
 			ie += 4, len -= 4;
 
 			switch (tlv_type) {



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