From: Dan Williams <dcbw@redhat.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] airo: Buffer overflow
Date: Mon, 27 Jul 2009 13:12:26 -0400 [thread overview]
Message-ID: <1248714746.17189.17.camel@localhost.localdomain> (raw)
In-Reply-To: <4A6B72E8.3060500@gmail.com>
On Sat, 2009-07-25 at 23:02 +0200, Roel Kluin wrote:
> SSID_rid has space for only 3 ssids.
> txPowerLevels[i] is read before the bounds check for i
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Dan Williams <dcbw@redhat.com>
> ---
> diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
> index c70604f..8ce5e4c 100644
> --- a/drivers/net/wireless/airo.c
> +++ b/drivers/net/wireless/airo.c
> @@ -5918,20 +5918,19 @@ static int airo_set_essid(struct net_device *dev,
> readSsidRid(local, &SSID_rid);
>
> /* Check if we asked for `any' */
> - if(dwrq->flags == 0) {
> + if (dwrq->flags == 0) {
> /* Just send an empty SSID list */
> memset(&SSID_rid, 0, sizeof(SSID_rid));
> } else {
> - int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
> + unsigned index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
>
> /* Check the size of the string */
> - if(dwrq->length > IW_ESSID_MAX_SIZE) {
> + if (dwrq->length > IW_ESSID_MAX_SIZE)
> return -E2BIG ;
> - }
> +
> /* Check if index is valid */
> - if((index < 0) || (index >= 4)) {
> + if (index >= ARRAY_SIZE(SSID_rid.ssids))
> return -EINVAL;
> - }
>
> /* Set the SSID */
> memset(SSID_rid.ssids[index].ssid, 0,
> @@ -6819,7 +6818,7 @@ static int airo_set_txpow(struct net_device *dev,
> return -EINVAL;
> }
> clear_bit (FLAG_RADIO_OFF, &local->flags);
> - for (i = 0; cap_rid.txPowerLevels[i] && (i < 8); i++)
> + for (i = 0; i < 8 && cap_rid.txPowerLevels[i]; i++)
> if (v == cap_rid.txPowerLevels[i]) {
> readConfigRid(local, 1);
> local->config.txPower = v;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2009-07-27 17:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-25 21:02 [PATCH] airo: Buffer overflow Roel Kluin
2009-07-27 17:12 ` Dan Williams [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1248714746.17189.17.camel@localhost.localdomain \
--to=dcbw@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=roel.kluin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).