From: Johannes Berg <johannes@sipsolutions.net>
To: Eliad Peller <eliad@wizery.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] cfg80211: add cfg80211_find_vendor_ie() function
Date: Thu, 15 Sep 2011 11:03:10 +0200 [thread overview]
Message-ID: <1316077390.3992.1.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <1316076781-12580-1-git-send-email-eliad@wizery.com> (sfid-20110915_105337_024525_83632A66)
> +const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
> + const u8 *ies, int len)
> +{
> + struct ieee80211_vendor_ie *ie;
> + const u8 *pos = ies, *end = ies + len;
> + int ie_oui;
> +
> + while (pos < end) {
> + pos = cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC, pos,
> + end - pos);
> + if (!pos)
> + return NULL;
> +
> + if (end - pos < sizeof(*ie))
> + return NULL;
> +
> + ie = (struct ieee80211_vendor_ie *)pos;
> + ie_oui = ie->oui[0] << 16 | ie->oui[1] << 8 | ie->oui[2];
> + if (ie_oui == oui && ie->oui_type == oui_type)
> + return pos;
> +
> + pos += 2 + ie->len;
I think it should also check that the whole IE including ie->len (not
just sizeof(*ie) fits into the buffer, before returning it. That is, add
something like
if (end - pos < 2 + ie->len)
return NULL;
after the sizeof(*ie) check.
johannes
next prev parent reply other threads:[~2011-09-15 9:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-15 8:53 [PATCH] cfg80211: add cfg80211_find_vendor_ie() function Eliad Peller
2011-09-15 9:03 ` Johannes Berg [this message]
2011-09-15 9:09 ` Eliad Peller
2011-09-15 9:18 ` Johannes Berg
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=1316077390.3992.1.camel@jlt3.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=eliad@wizery.com \
--cc=linux-wireless@vger.kernel.org \
/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