提交 d6a13a24 编写于 作者: D Dan Williams 提交者: John W. Linville

[PATCH] drivers/net/wireless: correct reported ssid lengths

ESSIDs can technically include NULL characters.  Drivers should not be
adjusting the length of the ESSID before reporting it in their
SIOCGIWESSID handlers.  Breaks stuff like wpa_supplicant.  Note that ipw
drivers, which seem to currently be the "most correct", don't have this
problem.
Signed-off-by: NDan Williams <dcbw@redhat.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 a485cde6
...@@ -5783,7 +5783,7 @@ static int airo_get_essid(struct net_device *dev, ...@@ -5783,7 +5783,7 @@ static int airo_get_essid(struct net_device *dev,
/* If none, we may want to get the one that was set */ /* If none, we may want to get the one that was set */
/* Push it out ! */ /* Push it out ! */
dwrq->length = status_rid.SSIDlen + 1; dwrq->length = status_rid.SSIDlen;
dwrq->flags = 1; /* active */ dwrq->flags = 1; /* active */
return 0; return 0;
......
...@@ -1718,11 +1718,11 @@ static int atmel_get_essid(struct net_device *dev, ...@@ -1718,11 +1718,11 @@ static int atmel_get_essid(struct net_device *dev,
if (priv->new_SSID_size != 0) { if (priv->new_SSID_size != 0) {
memcpy(extra, priv->new_SSID, priv->new_SSID_size); memcpy(extra, priv->new_SSID, priv->new_SSID_size);
extra[priv->new_SSID_size] = '\0'; extra[priv->new_SSID_size] = '\0';
dwrq->length = priv->new_SSID_size + 1; dwrq->length = priv->new_SSID_size;
} else { } else {
memcpy(extra, priv->SSID, priv->SSID_size); memcpy(extra, priv->SSID, priv->SSID_size);
extra[priv->SSID_size] = '\0'; extra[priv->SSID_size] = '\0';
dwrq->length = priv->SSID_size + 1; dwrq->length = priv->SSID_size;
} }
dwrq->flags = !priv->connect_to_any_BSS; /* active */ dwrq->flags = !priv->connect_to_any_BSS; /* active */
......
...@@ -748,7 +748,7 @@ prism54_get_essid(struct net_device *ndev, struct iw_request_info *info, ...@@ -748,7 +748,7 @@ prism54_get_essid(struct net_device *ndev, struct iw_request_info *info,
if (essid->length) { if (essid->length) {
dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */ dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */
/* if it is to big, trunk it */ /* if it is to big, trunk it */
dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length + 1); dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length);
} else { } else {
dwrq->flags = 0; dwrq->flags = 0;
dwrq->length = 0; dwrq->length = 0;
......
...@@ -1256,7 +1256,7 @@ static int ray_get_essid(struct net_device *dev, ...@@ -1256,7 +1256,7 @@ static int ray_get_essid(struct net_device *dev,
extra[IW_ESSID_MAX_SIZE] = '\0'; extra[IW_ESSID_MAX_SIZE] = '\0';
/* Push it out ! */ /* Push it out ! */
dwrq->length = strlen(extra) + 1; dwrq->length = strlen(extra);
dwrq->flags = 1; /* active */ dwrq->flags = 1; /* active */
return 0; return 0;
......
...@@ -2280,7 +2280,7 @@ static int wavelan_get_essid(struct net_device *dev, ...@@ -2280,7 +2280,7 @@ static int wavelan_get_essid(struct net_device *dev,
extra[IW_ESSID_MAX_SIZE] = '\0'; extra[IW_ESSID_MAX_SIZE] = '\0';
/* Set the length */ /* Set the length */
wrqu->data.length = strlen(extra) + 1; wrqu->data.length = strlen(extra);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册