DFS: Fix range availability check

There's off-by-one in the range availability check - the case of
first_chan_idx + num_chans == num_channels should be allowed (e.g., 0 +
1 == 1, for the case of a single 20 MHz channel).

Signed-off-by: Maital Hahn <maitalm@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
This commit is contained in:
Eliad Peller 2015-03-19 16:41:42 +02:00 committed by Jouni Malinen
parent 56ef99255c
commit 030a3e12da

View file

@ -143,7 +143,7 @@ static int dfs_chan_range_available(struct hostapd_hw_modes *mode,
struct hostapd_channel_data *first_chan, *chan; struct hostapd_channel_data *first_chan, *chan;
int i; int i;
if (first_chan_idx + num_chans >= mode->num_channels) if (first_chan_idx + num_chans > mode->num_channels)
return 0; return 0;
first_chan = &mode->channels[first_chan_idx]; first_chan = &mode->channels[first_chan_idx];