From bed230409f677daae0cd7dc646f83d69fc77764f Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Sun, 30 Oct 2005 16:31:05 +0000 Subject: [PATCH] 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] PR: bin/74509 --- sbin/ifconfig/ifieee80211.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index 6b348afbeb50..b7c6a826cb37 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); }