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]
Message-ID: <CY1PR11MB02187EB4971544D5B1336E4594D00@CY1PR11MB0218.namprd11.prod.outlook.com>
Date:	Wed, 3 Feb 2016 06:50:21 +0000
From:	Anil Gurumurthy <Anil.Gurumurthy@...gic.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
CC:	Sudarsana Kalluru <Sudarsana.Kalluru@...gic.com>,
	"James E.J. Bottomley" <JBottomley@...n.com>,
	"Martin K. Petersen" <martin.petersen@...cle.com>,
	linux-scsi <linux-scsi@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: RE: [patch] bfa: use strncpy() instead of memcpy()

Acked-by: Anil Gurumurthy <anil.gurumurthy@...gic.com>

-----Original Message-----
From: Dan Carpenter [mailto:dan.carpenter@...cle.com] 
Sent: 30 January 2016 20:06
To: Anil Gurumurthy <Anil.Gurumurthy@...gic.com>
Cc: Sudarsana Kalluru <Sudarsana.Kalluru@...gic.com>; James E.J. Bottomley <JBottomley@...n.com>; Martin K. Petersen <martin.petersen@...cle.com>; linux-scsi <linux-scsi@...r.kernel.org>; linux-kernel <linux-kernel@...r.kernel.org>; kernel-janitors@...r.kernel.org
Subject: [patch] bfa: use strncpy() instead of memcpy()

BFA_MFG_NAME is "QLogic" which is only 7 bytes, but we are copying 8 bytes.  It's harmless because the badding byte is likely zero but it makes static checkers complain.

Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
Technically the memset() is not needed because strncpy() will pad the rest of the buffer with zeros but I was worried that people would be paranoid.

diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 251e2ff..a1ada4a 100644
--- a/drivers/scsi/bfa/bfa_ioc.c
+++ b/drivers/scsi/bfa/bfa_ioc.c
@@ -2803,7 +2803,7 @@ void
 bfa_ioc_get_adapter_manufacturer(struct bfa_ioc_s *ioc, char *manufacturer)  {
 	memset((void *)manufacturer, 0, BFA_ADAPTER_MFG_NAME_LEN);
-	memcpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN);
+	strncpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN);
 }
 
 void

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ