Skip to content

Commit

Permalink
radiotap: fix bitmap-end-finding buffer overrun
Browse files Browse the repository at this point in the history
Evan Huus found (by fuzzing in wireshark) that the radiotap
iterator code can access beyond the length of the buffer if
the first bitmap claims an extension but then there's no
data at all. Fix this.

Cc: stable@vger.kernel.org
Reported-by: Evan Huus <eapache@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Dec 16, 2013
1 parent 4c4d684 commit bd02cd2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/wireless/radiotap.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ int ieee80211_radiotap_iterator_init(
/* find payload start allowing for extended bitmap(s) */

if (iterator->_bitmap_shifter & (1<<IEEE80211_RADIOTAP_EXT)) {
if ((unsigned long)iterator->_arg -
(unsigned long)iterator->_rtheader + sizeof(uint32_t) >
(unsigned long)iterator->_max_length)
return -EINVAL;
while (get_unaligned_le32(iterator->_arg) &
(1 << IEEE80211_RADIOTAP_EXT)) {
iterator->_arg += sizeof(uint32_t);
Expand Down

0 comments on commit bd02cd2

Please sign in to comment.