提交 8b967e41 编写于 作者: D Dan Carpenter 提交者: John W. Linville

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: NDan Carpenter <error27@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 b85aeb51
...@@ -186,7 +186,7 @@ int prism2_wds_add(local_info_t *local, u8 *remote_addr, ...@@ -186,7 +186,7 @@ int prism2_wds_add(local_info_t *local, u8 *remote_addr,
return -ENOBUFS; return -ENOBUFS;
/* verify that there is room for wds# postfix in the interface name */ /* verify that there is room for wds# postfix in the interface name */
if (strlen(local->dev->name) > IFNAMSIZ - 5) { if (strlen(local->dev->name) >= IFNAMSIZ - 5) {
printk(KERN_DEBUG "'%s' too long base device name\n", printk(KERN_DEBUG "'%s' too long base device name\n",
local->dev->name); local->dev->name);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册