[PATCH] hostapd: check validity of cwmin/cwmax values

Matthias May matthias.may
Tue May 5 06:55:54 PDT 2015


Add checks to ensure no invalid cwmin/cwmax parameter are set.

Signed-off-by: Matthias May <matthias.may at neratec.com>
---
 hostapd/config_file.c          | 5 +++++
 src/common/ieee802_11_common.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 0c1f401..a30260f 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -967,6 +967,11 @@ static int hostapd_config_tx_queue(struct hostapd_config *conf, char *name,
 		wpa_printf(MSG_ERROR, "Unknown tx_queue field '%s'", pos);
 		return -1;
 	}
+	if (queue->cwmin > queue->cwmax) {
+		wpa_printf(MSG_ERROR, "Invalid TX queue cwMin/cwMax values. "
+		"min(%d) greater than max(%d)", queue->cwmin, queue->cwmax);
+		return -1;
+	}
 
 	return 0;
 }
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index e23007a..c729c61 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -534,6 +534,11 @@ int hostapd_config_wmm_ac(struct hostapd_wmm_ac_params wmm_ac_params[],
 		wpa_printf(MSG_ERROR, "Unknown wmm_ac_ field '%s'", pos);
 		return -1;
 	}
+	if (ac->cwmin > ac->cwmax) {
+		wpa_printf(MSG_ERROR, "Invalid WMM ac cwMin/cwMax values. "
+		"min(%d) greater than max(%d)", ac->cwmin, ac->cwmax);
+		return -1;
+	}
 
 	return 0;
 }
-- 
2.1.4




More information about the Hostap mailing list