diff options
author | Andrew Thompson <thompsa@FreeBSD.org> | 2008-06-23 16:08:40 +0000 |
---|---|---|
committer | Andrew Thompson <thompsa@FreeBSD.org> | 2008-06-23 16:08:40 +0000 |
commit | cd610d1cb902c531a185f9fcecd6aa2a2d9152c1 (patch) | |
tree | d514ee9b641a5d292107295049c8a2d2c3524993 /sbin/ifconfig | |
parent | 6845408d73f5961999cc77c04eb6f2361738c6f6 (diff) | |
download | src-cd610d1cb902c531a185f9fcecd6aa2a2d9152c1.tar.gz src-cd610d1cb902c531a185f9fcecd6aa2a2d9152c1.zip |
Ensure the channel is a number and not a range, the 'channel' command can be
easily mixed up with 'chanlist' and would give unexpected results by fixing the
channel on the first number in the range.
Notes
Notes:
svn path=/head/; revision=179958
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r-- | sbin/ifconfig/ifieee80211.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index e81b6a3a023b..c35935394ebd 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -666,9 +666,12 @@ set80211channel(const char *val, int d, int s, const struct afswtch *rafp) memset(&chan, 0, sizeof(chan)); if (!isanyarg(val)) { int v, flags; + char *ep; getchaninfo(s); - v = atoi(val); + v = strtol(val, &ep, 10); + if (val[0] == '\0' || ep[0] != '\0' || errno == ERANGE) + errx(1, "invalid channel number"); flags = getchannelflags(val, v); if (v > 255) { /* treat as frequency */ mapfreq(&chan, v, flags); |