aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-07-10 18:10:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-07-12 16:05:32 -0400
commit8b967e41e0f75328150b7cddf79de4ee57616f01 (patch)
tree341131276969b7ee62c8de5d40e6d6367f5874d1 /drivers/net
parentb85aeb51805265b9f826857e5c5d9c0cd70dda55 (diff)
hostap: fixup strlen() math
In hostap_add_interface() we do: sprintf(dev->name, "%s%s", prefix, name); dev->name has IFNAMSIZ (16) characters. prefix is local->dev->name. name is "wds%d" strlen() returns the number of characters in the string not counting the NULL so if we have a string with 11 characters we get "12345678901wds%d" which is 16 characters and a NULL so we're past the end of the array. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/hostap/hostap_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index eaee84b55887..25a2722c8a98 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -186,7 +186,7 @@ int prism2_wds_add(local_info_t *local, u8 *remote_addr,
186 return -ENOBUFS; 186 return -ENOBUFS;
187 187
188 /* verify that there is room for wds# postfix in the interface name */ 188 /* verify that there is room for wds# postfix in the interface name */
189 if (strlen(local->dev->name) > IFNAMSIZ - 5) { 189 if (strlen(local->dev->name) >= IFNAMSIZ - 5) {
190 printk(KERN_DEBUG "'%s' too long base device name\n", 190 printk(KERN_DEBUG "'%s' too long base device name\n",
191 local->dev->name); 191 local->dev->name);
192 return -EINVAL; 192 return -EINVAL;