[PATCH] staging: rtl8192e: prefer strscpy over strncpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Replace strncpy with strscpy in two places where the destination buffer
should be NUL-terminated. Found by checkpatch.

WARNING: Prefer strscpy, strscpy_pad, or __nonstring over strncpy - see: https://github.com/KSPP/linux/issues/90

Signed-off-by: Michael Straube <straube.linux@xxxxxxxxx>
---
 drivers/staging/rtl8192e/rtllib_softmac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 0e52b207942d..bd19d6a2ce41 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -1564,7 +1564,7 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,
 				    (!strncmp(ieee->current_network.ssid,
 				    net->hidden_ssid, net->hidden_ssid_len));
 			if (net->hidden_ssid_len > 0) {
-				strncpy(net->ssid, net->hidden_ssid,
+				strscpy(net->ssid, net->hidden_ssid,
 					net->hidden_ssid_len);
 				net->ssid_len = net->hidden_ssid_len;
 				ssidbroad = 1;
@@ -2431,7 +2431,7 @@ static void rtllib_start_master_bss(struct rtllib_device *ieee)
 	ieee->assoc_id = 1;
 
 	if (ieee->current_network.ssid_len == 0) {
-		strncpy(ieee->current_network.ssid,
+		strscpy(ieee->current_network.ssid,
 			RTLLIB_DEFAULT_TX_ESSID,
 			IW_ESSID_MAX_SIZE);
 
-- 
2.41.0





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux