Search Linux Wireless

Re: [PATCH] libertas: Read outside array bounds

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

 



On Tue, 2009-07-28 at 09:59 +0200, Roel Kluin wrote:
> reads bss->rates[j] before checking bounds of index, and should use
> ARRAY_SIZE to determine the size of the array.
> 
> Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>

Acked-by: Dan Williams <dcbw@xxxxxxxxxx>

> ---
> diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
> index 601b542..6c95af3 100644
> --- a/drivers/net/wireless/libertas/scan.c
> +++ b/drivers/net/wireless/libertas/scan.c
> @@ -5,6 +5,7 @@
>    *  for sending scan commands to the firmware.
>    */
>  #include <linux/types.h>
> +#include <linux/kernel.h>
>  #include <linux/etherdevice.h>
>  #include <linux/if_arp.h>
>  #include <asm/unaligned.h>
> @@ -876,7 +877,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
>  	iwe.u.bitrate.disabled = 0;
>  	iwe.u.bitrate.value = 0;
>  
> -	for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) {
> +	for (j = 0; j < ARRAY_SIZE(bss->rates) && bss->rates[j]; j++) {
>  		/* Bit rate given in 500 kb/s units */
>  		iwe.u.bitrate.value = bss->rates[j] * 500000;
>  		current_val = iwe_stream_add_value(info, start, current_val,

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux