summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2005-10-30 16:31:05 +0000
committerbrooks <brooks@FreeBSD.org>2005-10-30 16:31:05 +0000
commite61dac6ecc4ea6d91d135283b63ce8edae71e459 (patch)
tree944c08955884c917a660b5cc8ae1bd40376b0fa4 /sbin/ifconfig
parented08782bf8ee676ec064b43620669c300f102875 (diff)
downloadFreeBSD-src-e61dac6ecc4ea6d91d135283b63ce8edae71e459.zip
FreeBSD-src-e61dac6ecc4ea6d91d135283b63ce8edae71e459.tar.gz
SSIDs are of length 32-bytes and not NUL terminated. Use the correct
length and bail immediatly if the returned length is wrong rather than attempting to set an correct value. This commit differs from the patch in the PR in the use of exit instead of return and the use of a defined value for the array. Submitted by: Daan Vreeken [PA4DAN] <Danovitsch at Vitsch dot net> PR: bin/74509
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/ifieee80211.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index 6b348af..b7c6a82 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -110,7 +110,7 @@ set80211ssid(const char *val, int d, int s, const struct afswtch *rafp)
{
int ssid;
int len;
- u_int8_t data[33];
+ u_int8_t data[IEEE80211_NWID_LEN];
ssid = 0;
len = strlen(val);
@@ -121,7 +121,8 @@ set80211ssid(const char *val, int d, int s, const struct afswtch *rafp)
bzero(data, sizeof(data));
len = sizeof(data);
- get_string(val, NULL, data, &len);
+ if (get_string(val, NULL, data, &len) == NULL)
+ exit(1);
set80211(s, IEEE80211_IOC_SSID, ssid, len, data);
}
OpenPOWER on IntegriCloud