Search Linux Wireless

[PATCH] wirelesstools: More user space validation of channel/frequency

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

 



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@xxxxxxx>
---
--- 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;


-
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