From e6a4fb6f3c49aaf17760624b6cb55e41bab6cf42 Mon Sep 17 00:00:00 2001 From: brooks Date: Wed, 11 Jan 2006 05:56:02 +0000 Subject: [PATCH] MFC revs 1.27 and 1.28. 1.27: don't crash when given an invalid nwkey string 1.28: parse SSIDs correctly and bail immediatly when invalid PR: misc/88159, bin/74509 --- sbin/ifconfig/ifieee80211.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index ca1e67776d62..0e808ca2f294 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); } @@ -322,6 +323,8 @@ set80211nwkey(const char *val, int d, int s, const struct afswtch *rafp) bzero(data, sizeof(data)); len = sizeof(data); val = get_string(val, ",", data, &len); + if (val == NULL) + exit(1); set80211(s, IEEE80211_IOC_WEPKEY, i, len, data); }