summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig/ifieee80211.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/ifconfig/ifieee80211.c')
-rw-r--r--sbin/ifconfig/ifieee80211.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index e81b6a3..c359353 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);
OpenPOWER on IntegriCloud