lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 20 Jun 2013 18:49:44 +0800
From:	Zhao Hongjiang <zhaohongjiang@...wei.com>
To:	<davem@...emloft.net>
CC:	<kuznet@....inr.ac.ru>, <jmorris@...ei.org>,
	<yoshfuji@...ux-ipv6.org>, <kaber@...sh.net>,
	<netdev@...r.kernel.org>, Zhao Hongjiang <zhaohongjiang@...wei.com>
Subject: [PATCH 4/5] net: irda: using strlcpy instead of strncpy

for NUL terminated string, need alway set '\0' in the end.

Signed-off-by: Zhao Hongjiang <zhaohongjiang@...wei.com>
---
 net/irda/af_irda.c             |    2 +-
 net/irda/ircomm/ircomm_param.c |    3 ++-
 net/irda/irttp.c               |    2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 0578d4f..f605d23 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -480,7 +480,7 @@ static int irda_open_tsap(struct irda_sock *self, __u8 tsap_sel, char *name)
 	notify.udata_indication	     = irda_data_indication;
 	notify.flow_indication       = irda_flow_indication;
 	notify.instance = self;
-	strncpy(notify.name, name, NOTIFY_MAX_NAME);
+	strlcpy(notify.name, name, sizeof(notify.name));
 
 	self->tsap = irttp_open_tsap(tsap_sel, DEFAULT_INITIAL_CREDIT,
 				     &notify);
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c
index 3089391..5b80be8 100644
--- a/net/irda/ircomm/ircomm_param.c
+++ b/net/irda/ircomm/ircomm_param.c
@@ -259,7 +259,8 @@ static int ircomm_param_port_name(void *instance, irda_param_t *param, int get)
 		IRDA_DEBUG(0, "%s(), not imp!\n", __func__ );
 	} else {
 		IRDA_DEBUG(0, "%s(), port-name=%s\n", __func__ , param->pv.c);
-		strncpy(self->settings.port_name, param->pv.c, 32);
+		strlcpy(self->settings.port_name, param->pv.c,
+			sizeof(self->settings.port_name));
 	}
 
 	return 0;
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index ae43c62..b6e1c9f 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -430,7 +430,7 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify)
 	if(notify->status_indication != NULL)
 		ttp_notify.status_indication = irttp_status_indication;
 	ttp_notify.instance = self;
-	strncpy(ttp_notify.name, notify->name, NOTIFY_MAX_NAME);
+	strlcpy(ttp_notify.name, notify->name, sizeof(ttp_notify.name));
 
 	self->magic = TTP_TSAP_MAGIC;
 	self->connected = FALSE;
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ