Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Mar 2018 07:14:56 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r330448 - stable/11/sbin/ifconfig
Message-ID:  <201803050714.w257EuL3081242@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Mon Mar  5 07:14:56 2018
New Revision: 330448
URL: https://svnweb.freebsd.org/changeset/base/330448

Log:
  MFC r314181:
  
  [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

Modified:
  stable/11/sbin/ifconfig/ifieee80211.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ifconfig/ifieee80211.c
==============================================================================
--- stable/11/sbin/ifconfig/ifieee80211.c	Mon Mar  5 07:08:58 2018	(r330447)
+++ stable/11/sbin/ifconfig/ifieee80211.c	Mon Mar  5 07:14:56 2018	(r330448)
@@ -2997,6 +2997,14 @@ printwpsie(const char *tag, const u_int8_t *ie, size_t
 			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?201803050714.w257EuL3081242>