[patch 2/2] wlan-ng: add a bounds check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index dc221f2..428a9be 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -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);
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux