Skip to content

Commit

Permalink
wlan-ng: add a bounds check
Browse files Browse the repository at this point in the history
I'm not sure where these results come from, but it can't hurt to
add a sanity check the array offset.  The .results[] array on the
next line has HFA384x_CHINFORESULT_MAX (16) elements.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Mar 11, 2013
1 parent a0cdd2e commit 72c1c06
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/staging/wlan-ng/prism2sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,9 @@ static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
result = &inf->info.chinforesult.result[n];
chan = le16_to_cpu(result->chid) - 1;

if (chan < 0 || chan >= HFA384x_CHINFORESULT_MAX)
continue;

chinforesult = &hw->channel_info.results.result[chan];
chinforesult->chid = chan;
chinforesult->anl = le16_to_cpu(result->anl);
Expand Down

0 comments on commit 72c1c06

Please sign in to comment.