netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/net/wireless/ipw2x00: use strlcpy instead of strncpy
@ 2013-01-05 13:41 Chen Gang
  2013-01-05 14:42 ` Joe Perches
  0 siblings, 1 reply; 15+ messages in thread
From: Chen Gang @ 2013-01-05 13:41 UTC (permalink / raw)
  To: stas.yakovlev, linville; +Cc: linux-wireless, netdev


  The fields must be null-terminated, or IPW_DEBUG_ASSOC will cause issue.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 drivers/net/wireless/ipw2x00/ipw2200.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 844f201..c85261b 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -5558,7 +5558,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
 			    min(network->ssid_len, priv->essid_len)))) {
 			char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
 
-			strncpy(escaped,
+			strlcpy(escaped,
 				print_ssid(ssid, network->ssid,
 					   network->ssid_len),
 				sizeof(escaped));
@@ -5771,7 +5771,7 @@ static int ipw_best_network(struct ipw_priv *priv,
 		     memcmp(network->ssid, priv->essid,
 			    min(network->ssid_len, priv->essid_len)))) {
 			char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
-			strncpy(escaped,
+			strlcpy(escaped,
 				print_ssid(ssid, network->ssid,
 					   network->ssid_len),
 				sizeof(escaped));
@@ -5788,7 +5788,7 @@ static int ipw_best_network(struct ipw_priv *priv,
 	 * testing everything else. */
 	if (match->network && match->network->stats.rssi > network->stats.rssi) {
 		char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
-		strncpy(escaped,
+		strlcpy(escaped,
 			print_ssid(ssid, network->ssid, network->ssid_len),
 			sizeof(escaped));
 		IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded because "
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-01-08  3:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-05 13:41 [PATCH] drivers/net/wireless/ipw2x00: use strlcpy instead of strncpy Chen Gang
2013-01-05 14:42 ` Joe Perches
2013-01-07  2:49   ` Chen Gang
     [not found]     ` <50EA37CE.1090901-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
2013-01-07  2:57       ` Chen Gang F T
2013-01-07  3:19     ` Joe Perches
2013-01-07  3:42       ` Chen Gang F T
2013-01-07  4:49       ` [RFC PATCH] vsprintf: Add %p*D extension for 80211 SSIDs Joe Perches
2013-01-07  6:07         ` Chen Gang
     [not found]           ` <50EA6612.6010506-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
2013-01-07  6:37             ` Joe Perches
2013-01-07  6:58               ` Chen Gang
2013-01-07  7:47         ` Johannes Berg
2013-01-07 17:22           ` Joe Perches
2013-01-08  2:57             ` Chen Gang
     [not found]               ` <50EB8B1A.9000404-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
2013-01-08  3:11                 ` Joe Perches
2013-01-08  3:20                   ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).