[PATCH] libertas: beyond ARRAY_SIZE of defs.meshie.val.mesh_id

Roel Kluin roel.kluin at gmail.com
Tue May 19 20:08:17 EDT 2009


Do not go beyond ARRAY_SIZE of defs.meshie.val.mesh_id

Signed-off-by: Roel Kluin <roel.kluin at gmail.com>
---
Or should the arraysize be increased by 1? please review.

diff --git a/drivers/net/wireless/libertas/persistcfg.c b/drivers/net/wireless/libertas/persistcfg.c
index 18fe29f..6e7b1f3 100644
--- a/drivers/net/wireless/libertas/persistcfg.c
+++ b/drivers/net/wireless/libertas/persistcfg.c
@@ -187,9 +187,9 @@ static ssize_t mesh_id_get(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		return ret;
 
-	if (defs.meshie.val.mesh_id_len > IW_ESSID_MAX_SIZE) {
+	if (defs.meshie.val.mesh_id_len >= IW_ESSID_MAX_SIZE) {
 		lbs_pr_err("inconsistent mesh ID length");
-		defs.meshie.val.mesh_id_len = IW_ESSID_MAX_SIZE;
+		defs.meshie.val.mesh_id_len = IW_ESSID_MAX_SIZE - 1;
 	}
 
 	/* SSID not null terminated: reserve room for \0 + \n */



More information about the libertas-dev mailing list