From: Andrew Lunn <andrew@lunn.ch>
To: Johannes Berg <johannes@sipsolutions.net>, jt@hpl.hp.com
Cc: Andrew Lunn <andrew@lunn.ch>,
flamingice@sourmilk.net, linux-wireless@vger.kernel.org,
linville@tuxdriver.com
Subject: [PATCH] wirelesstools: More user space validation of channel/frequency
Date: Thu, 13 Dec 2007 14:07:54 +0100 [thread overview]
Message-ID: <20071213130754.GE501@lunn.ch> (raw)
In-Reply-To: <1197550398.6558.257.camel@johannes.berg>
On Thu, Dec 13, 2007 at 01:53:18PM +0100, Johannes Berg wrote:
>
> > However this description does not match the implementation. The
> > implementation is that its a channel if e = 0. My "frequency" is > 1000,
> > but it was still interpreted as a channel. Looking at the
> > implementation of iw_float2freq(), the description should be that a
> > value less than 1e9 is a channel.
> >
> > So there should really be a check in the user space tools which says
> > that values between 1000 and 1e9 are invalid. This would catch errors
> > like the one i made for both 2.4GHz and 5GHz.
>
> Yeah, well, we all know wext sucks. You are of course right, but I think
> that nobody's motivated any more to fix things.
Well, here is a patch suggestion. If it got me, it will get others,
and i think this little patch will help.
Andrew
Signed-off-by Andrew Lunn <andrew@lunn.ch>
---
--- wireless_tools.30-clean/iwconfig.c 2007-09-18 01:38:08.000000000 +0200
+++ wireless_tools.30/iwconfig.c 2007-12-13 13:57:16.000000000 +0100
@@ -791,6 +791,13 @@
if(unit[0] == 'k') freq *= KILO;
}
+ if (freq >= 1000.0 && freq < 1e9) {
+ fprintf(stderr, "Invalid channel/frequency. \n");
+ fprintf(stderr, "Channels must be < 1000. \n");
+ fprintf(stderr, "Frequencies must be > 1GHz\n");
+ return (IWERR_ARG_TYPE);
+ }
+
iw_float2freq(freq, &(wrq.u.freq));
wrq.u.freq.flags = IW_FREQ_FIXED;
next prev parent reply other threads:[~2007-12-13 13:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-12 15:31 [PATCH] mac80211: Fix swapped parameters to ieee80211_set_channel() Andrew Lunn
2007-12-12 17:43 ` Johannes Berg
2007-12-12 18:02 ` [PATCH] try 2: " Andrew Lunn
2007-12-12 18:09 ` Johannes Berg
2007-12-13 0:16 ` Johannes Berg
2007-12-13 12:09 ` Andrew Lunn
2007-12-13 12:30 ` Johannes Berg
2007-12-13 12:50 ` Andrew Lunn
2007-12-13 12:53 ` Johannes Berg
2007-12-13 13:07 ` Andrew Lunn [this message]
2007-12-13 12:37 ` Andrew Lunn
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=20071213130754.GE501@lunn.ch \
--to=andrew@lunn.ch \
--cc=flamingice@sourmilk.net \
--cc=johannes@sipsolutions.net \
--cc=jt@hpl.hp.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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).